mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: Colin King <colin.king@canonical.com>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] staging: rtl8188eu: Fix null pointer dereference on free_netdev call
Date: Wed, 24 Mar 2021 17:11:07 +0100	[thread overview]
Message-ID: <20210324161107.m7gbexp4e7e5vf77@viti.kaiser.cx> (raw)
In-Reply-To: <20210324152135.254152-1-colin.king@canonical.com>

Hello Colin,

Thus wrote Colin King (colin.king@canonical.com):

> From: Colin Ian King <colin.king@canonical.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@canonical.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.

Reviewed-by: Martin Kaiser <martin@kaiser.cx>

Best regards,
Martin

  reply	other threads:[~2021-03-24 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 15:21 Colin King
2021-03-24 16:11 ` Martin Kaiser [this message]
2021-03-24 16:12   ` Colin Ian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210324161107.m7gbexp4e7e5vf77@viti.kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=Larry.Finger@lwfinger.net \
    --cc=colin.king@canonical.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®