From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dinghao Liu <dinghao.liu@zju.edu.cn>
Cc: kjlu@umn.edu, devel@driverdev.osuosl.org,
Camylla Goncalves Cantanheide <c.cantanheide@gmail.com>,
Zhang Qilong <zhangqilong3@huawei.com>,
linux-kernel@vger.kernel.org,
Colin Ian King <colin.king@canonical.com>,
Allen Pais <apais@linux.microsoft.com>,
Masahiro Yamada <masahiroy@kernel.org>
Subject: Re: [PATCH] staging: rtl8192u: Add null check in rtl8192_usb_initendpoints
Date: Mon, 28 Dec 2020 15:11:14 +0100 [thread overview]
Message-ID: <X+nngl0/JxETbSjT@kroah.com> (raw)
In-Reply-To: <20201226080258.6576-1-dinghao.liu@zju.edu.cn>
On Sat, Dec 26, 2020 at 04:02:56PM +0800, Dinghao Liu wrote:
> There is an allocation for priv->rx_urb[16] has no null check,
> which may lead to a null pointer dereference.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/staging/rtl8192u/r8192U_core.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 93676af98629..9fc4adc83d77 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -1608,6 +1608,8 @@ static short rtl8192_usb_initendpoints(struct net_device *dev)
> void *oldaddr, *newaddr;
>
> priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
> + if (!priv->rx_urb[16])
> + return -ENOMEM;
> priv->oldaddr = kmalloc(16, GFP_KERNEL);
> if (!priv->oldaddr)
> return -ENOMEM;
There is a bug here, where the memory is not freed from the alloc urb
call, right?
Anyway, something to fix up in a leter patch, thanks.
greg k-h
prev parent reply other threads:[~2020-12-28 14:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-26 8:02 Dinghao Liu
2020-12-28 14:11 ` Greg Kroah-Hartman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=X+nngl0/JxETbSjT@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=apais@linux.microsoft.com \
--cc=c.cantanheide@gmail.com \
--cc=colin.king@canonical.com \
--cc=devel@driverdev.osuosl.org \
--cc=dinghao.liu@zju.edu.cn \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=zhangqilong3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®