[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <X+nngl0/JxETbSjT@kroah.com>
Date: Mon, 28 Dec 2020 15:11:14 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Dinghao Liu <dinghao.liu@....edu.cn>
Cc: kjlu@....edu, devel@...verdev.osuosl.org,
Camylla Goncalves Cantanheide <c.cantanheide@...il.com>,
Zhang Qilong <zhangqilong3@...wei.com>,
linux-kernel@...r.kernel.org,
Colin Ian King <colin.king@...onical.com>,
Allen Pais <apais@...ux.microsoft.com>,
Masahiro Yamada <masahiroy@...nel.org>
Subject: Re: [PATCH] staging: rtl8192u: Add null check in
rtl8192_usb_initendpoints
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@....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
Powered by blists - more mailing lists