Re: [PATCH][next] staging: rtl8188eu: Fix null pointer dereference on free_netdev call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Colin,

Thus wrote Colin King (colin.king@xxxxxxxxxxxxx):

> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

> An unregister_netdev call checks if pnetdev is null, hence a later
> call to free_netdev can potentially be passing a null pointer, causing
> a null pointer dereference. Avoid this by adding a null pointer check
> on pnetdev before calling free_netdev.

> Fixes: 1665c8fdffbb ("staging: rtl8188eu: use netdev routines for private data")
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
> ---
>  drivers/staging/rtl8188eu/os_dep/usb_intf.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/drivers/staging/rtl8188eu/os_dep/usb_intf.c b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> index 518e9feb3f46..91a3d34a1050 100644
> --- a/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> +++ b/drivers/staging/rtl8188eu/os_dep/usb_intf.c
> @@ -446,7 +446,8 @@ static void rtw_usb_if1_deinit(struct adapter *if1)
>  	pr_debug("+r871xu_dev_remove, hw_init_completed=%d\n",
>  		 if1->hw_init_completed);
>  	rtw_free_drv_sw(if1);
> -	free_netdev(pnetdev);
> +	if (pnetdev)
> +		free_netdev(pnetdev);
>  }

>  static int rtw_drv_init(struct usb_interface *pusb_intf, const struct usb_device_id *pdid)
> -- 
> 2.30.2

you're right. I removed the NULL check that was part of rtw_free_netdev.
Sorry for the mistake and thanks for your fix.

Reviewed-by: Martin Kaiser <martin@xxxxxxxxx>

Best regards,
Martin



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux