[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <028e75cd-6229-6004-84bb-ca751346420d@canonical.com>
Date: Wed, 24 Mar 2021 16:12:08 +0000
From: Colin Ian King <colin.king@...onical.com>
To: Martin Kaiser <martin@...ser.cx>
Cc: Larry Finger <Larry.Finger@...inger.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-staging@...ts.linux.dev, kernel-janitors@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH][next] staging: rtl8188eu: Fix null pointer dereference on
free_netdev call
On 24/03/2021 16:11, Martin Kaiser wrote:
> Hello Colin,
>
> Thus wrote Colin King (colin.king@...onical.com):
>
>> From: Colin Ian King <colin.king@...onical.com>
>
>> 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@...onical.com>
>> ---
>> 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.
Thank static analysis :-)
>
> Reviewed-by: Martin Kaiser <martin@...ser.cx>
>
> Best regards,
> Martin
>
Powered by blists - more mailing lists