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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 Jul 2019 14:45:28 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Navid Emamdoost <navid.emamdoost@...il.com>
Cc:     devel@...verdev.osuosl.org, secalert@...hat.com, kjlu@....edu,
        linux-kernel@...r.kernel.org,
        John Whitmore <johnfwhitmore@...il.com>, emamd001@....edu,
        Nishka Dasgupta <nishkadg.linux@...il.com>, smccaman@....edu,
        Colin Ian King <colin.king@...onical.com>
Subject: Re: [PATCH] rtl8192_init_priv_variable: null check is missing for
 kzalloc

On Sat, Jul 20, 2019 at 03:25:44PM -0500, Navid Emamdoost wrote:
> Allocation for priv->pFirmware may fail, so a null check is necessary.
> priv->pFirmware is accessed at line 2743. I added the check and made
> appropriate changes to propagate the errno to the caller.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index fe1f279ca368..5fb24b13ce5b 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -2096,7 +2096,7 @@ static void rtl8192_SetWirelessMode(struct net_device *dev, u8 wireless_mode)
>  }
>  
>  /* init priv variables here. only non_zero value should be initialized here. */
> -static void rtl8192_init_priv_variable(struct net_device *dev)
> +static int rtl8192_init_priv_variable(struct net_device *dev)
>  {
>  	struct r8192_priv *priv = ieee80211_priv(dev);
>  	u8 i;
> @@ -2223,6 +2223,10 @@ static void rtl8192_init_priv_variable(struct net_device *dev)
>  
>  	priv->AcmControl = 0;
>  	priv->pFirmware = kzalloc(sizeof(rt_firmware), GFP_KERNEL);
> +	if (!priv->pFirmware) {
> +		return -ENOMEM;
> +	}
> +
>  
>  	/* rx related queue */
>  	skb_queue_head_init(&priv->rx_queue);
> @@ -2236,6 +2240,8 @@ static void rtl8192_init_priv_variable(struct net_device *dev)
>  	for (i = 0; i < MAX_QUEUE_SIZE; i++)
>  		skb_queue_head_init(&priv->ieee80211->skb_drv_aggQ[i]);
>  	priv->rf_set_chan = rtl8192_phy_SwChnl;
> +
> +	return 0;
>  }
>  
>  /* init lock here */
> @@ -2605,7 +2611,10 @@ static short rtl8192_init(struct net_device *dev)
>  		memcpy(priv->txqueue_to_outpipemap, queuetopipe, 9);
>  	}
>  #endif
> -	rtl8192_init_priv_variable(dev);
> +	err = rtl8192_init_priv_variable(dev);
> +	if (err) {
> +		return err;
> +	}

Always run checkpatch.pl on your patch before sending it so you do not
get grumpy emails telling you to run checkpatch.pl before sending your
patch :)


thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ