lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dd1c45ad-7af2-8df1-a3ab-0db99dd25934@wanadoo.fr>
Date:   Fri, 3 Feb 2023 07:25:45 +0100
From:   Christophe JAILLET <christophe.jaillet@...adoo.fr>
To:     Zheng Wang <zyytlz.wz@....com>, srini.raju@...elifi.com
Cc:     kvalo@...nel.org, davem@...emloft.net, edumazet@...gle.com,
        kuba@...nel.org, pabeni@...hat.com, linux-wireless@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] wifi: plfxlc: fix potential NULL pointer dereference in
 plfxlc_usb_wreq_async()

Le 03/02/2023 à 05:16, Zheng Wang a écrit :
> Although the usb_alloc_urb uses GFP_ATOMIC, tring to make sure the memory
>   allocated not to be NULL. But in some low-memory situation, it's still
>   possible to return NULL. It'll pass urb as argument in
>   usb_fill_bulk_urb, which will finally lead to a NULL pointer dereference.
> 
> Fix it by adding additional check.
> 
> Note that, as a bug found by static analysis, it can be a false
> positive or hard to trigger.
> 
> Fixes: 68d57a07bfe5 ("wireless: add plfxlc driver for pureLiFi X, XL, XC devices")
> 
> Signed-off-by: Zheng Wang <zyytlz.wz@....com>
> ---
>   drivers/net/wireless/purelifi/plfxlc/usb.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c
> index 76d0a778636a..ac149aa64908 100644
> --- a/drivers/net/wireless/purelifi/plfxlc/usb.c
> +++ b/drivers/net/wireless/purelifi/plfxlc/usb.c
> @@ -496,10 +496,17 @@ int plfxlc_usb_wreq_async(struct plfxlc_usb *usb, const u8 *buffer,
>   	struct urb *urb = usb_alloc_urb(0, GFP_ATOMIC);
>   	int r;
>   
> +	if (!urb) {
> +		r = -ENOMEM;
> +		kfree(urb);

Hi,
why kfree() in such a case?

CJ

> +		goto out;
> +	}
>   	usb_fill_bulk_urb(urb, udev, usb_sndbulkpipe(udev, EP_DATA_OUT),
>   			  (void *)buffer, buffer_len, complete_fn, context);
>   
>   	r = usb_submit_urb(urb, GFP_ATOMIC);
> +
> +out:
>   	if (r)
>   		dev_err(&udev->dev, "Async write submit failed (%d)\n", r);
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ