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: <Y/w16PI4klfJaeXA@kadam>
Date:   Mon, 27 Feb 2023 07:47:36 +0300
From:   Dan Carpenter <error27@...il.com>
To:     Kang Chen <void0red@...il.com>
Cc:     paskripkin@...il.com, Larry.Finger@...inger.net,
        phil@...lpotter.co.uk, gregkh@...uxfoundation.org,
        linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] staging: r8188eu: add a null check of kzalloc in
 go_add_group_info_attr

On Sun, Feb 26, 2023 at 09:25:00PM +0800, Kang Chen wrote:
> kzalloc may fails, pdata_attr might be null and will cause
> illegal address access later.
> 
> Signed-off-by: Kang Chen <void0red@...il.com>
> ---
>  drivers/staging/r8188eu/core/rtw_p2p.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/staging/r8188eu/core/rtw_p2p.c b/drivers/staging/r8188eu/core/rtw_p2p.c
> index 93d3c9c43..802e1170a 100644
> --- a/drivers/staging/r8188eu/core/rtw_p2p.c
> +++ b/drivers/staging/r8188eu/core/rtw_p2p.c
> @@ -31,6 +31,8 @@ static u32 go_add_group_info_attr(struct wifidirect_info *pwdinfo, u8 *pbuf)
>  	struct sta_priv *pstapriv = &padapter->stapriv;
>  
>  	pdata_attr = kzalloc(MAX_P2P_IE_LEN, GFP_KERNEL);
> +	if (!pdata_attr)
> +		return 0;

Return success here is not a good thing.  We have to fix the caller to
check for errors.  (Fixing a bug half way just makes it harder to find
the bug so it makes the situation worse).

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ