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] [day] [month] [year] [list]
Message-ID: <20211201070457.GD9522@kadam>
Date:   Wed, 1 Dec 2021 10:04:57 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Yang Yingliang <yangyingliang@...wei.com>
Cc:     linux-kernel@...r.kernel.org, linux-staging@...ts.linux.dev,
        gregkh@...uxfoundation.org, paskripkin@...il.com
Subject: Re: [PATCH -next v2] staging: rtl8192e: rtllib_module: fix missing
 free_netdev() on error in alloc_rtllib()

I just sent an reply to the v1 patch with more explanations.

On Wed, Dec 01, 2021 at 02:29:08PM +0800, Yang Yingliang wrote:
> diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c
> index 64d9feee1f39..105c58e749d6 100644
> --- a/drivers/staging/rtl8192e/rtllib_module.c
> +++ b/drivers/staging/rtl8192e/rtllib_module.c
> @@ -121,11 +121,12 @@ struct net_device *alloc_rtllib(int sizeof_priv)
>  	ieee->hwsec_active = 0;
>  
>  	memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32);
> -	rtllib_softmac_init(ieee);
> +	if (rtllib_softmac_init(ieee))
> +		goto failed;

Please write this like so:

	err = rtllib_softmac_init(ieee);
	if (err)
		goto failed;

Otherwise it suggests that rtllib_softmac_init() returns boolean or
something.  I suggest changing rtllib_softmac_init() in a separate
patch 2/2.

> @@ -2962,8 +2962,10 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
>  	for (i = 0; i < 5; i++)
>  		ieee->seq_ctrl[i] = 0;
>  	ieee->dot11d_info = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC);
> -	if (!ieee->dot11d_info)
> +	if (!ieee->dot11d_info) {
>  		netdev_err(ieee->dev, "Can't alloc memory for DOT11D\n");

This error message should be deleted.  The kzalloc() function already
has a more useful message.

> +		return -ENOMEM;
> +	}
>  	ieee->LinkDetectInfo.SlotIndex = 0;
>  	ieee->LinkDetectInfo.SlotNum = 2;
>  	ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0;

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ