From: Greg KH <gregkh@linuxfoundation.org>
To: Ying Lu <luying526@gmail.com>
Cc: oneukum@suse.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Ying Lu <luying1@xiaomi.com>
Subject: Re: [PATCH v3 1/1] usbnet:fix NPE during rx_complete
Date: Wed, 2 Apr 2025 09:11:30 +0100 [thread overview]
Message-ID: <2025040218-uphill-mouth-c528@gregkh> (raw)
In-Reply-To: <11211b6967816ce4eac2ff5341d78b09de4f6747.1743580881.git.luying1@xiaomi.com>
On Wed, Apr 02, 2025 at 04:06:29PM +0800, Ying Lu wrote:
> From: Ying Lu <luying1@xiaomi.com>
>
> Missing usbnet_going_away Check in Critical Path.
> The usb_submit_urb function lacks a usbnet_going_away
> validation, whereas __usbnet_queue_skb includes this check.
>
> This inconsistency creates a race condition where:
> A URB request may succeed, but the corresponding SKB data
> fails to be queued.
>
> Subsequent processes:
> (e.g., rx_complete → defer_bh → __skb_unlink(skb, list))
> attempt to access skb->next, triggering a NULL pointer
> dereference (Kernel Panic).
>
> Fixes: 04e906839a05 ("usbnet: fix cyclical race on disconnect with work queue")
> Signed-off-by: Ying Lu <luying1@xiaomi.com>
> ---
> drivers/net/usb/usbnet.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
> index 44179f4e807f..5161bb5d824b 100644
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -519,7 +519,8 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
> netif_device_present (dev->net) &&
> test_bit(EVENT_DEV_OPEN, &dev->flags) &&
> !test_bit (EVENT_RX_HALT, &dev->flags) &&
> - !test_bit (EVENT_DEV_ASLEEP, &dev->flags)) {
> + !test_bit (EVENT_DEV_ASLEEP, &dev->flags) &&
> + !usbnet_going_away(dev)) {
> switch (retval = usb_submit_urb (urb, GFP_ATOMIC)) {
> case -EPIPE:
> usbnet_defer_kevent (dev, EVENT_RX_HALT);
> @@ -540,8 +541,7 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
> tasklet_schedule (&dev->bh);
> break;
> case 0:
> - if (!usbnet_going_away(dev))
> - __usbnet_queue_skb(&dev->rxq, skb, rx_start);
> + __usbnet_queue_skb(&dev->rxq, skb, rx_start);
> }
> } else {
> netif_dbg(dev, ifdown, dev->net, "rx: stopped\n");
> --
> 2.49.0
>
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- You have marked a patch with a "Fixes:" tag for a commit that is in an
older released kernel, yet you do not have a cc: stable line in the
signed-off-by area at all, which means that the patch will not be
applied to any older kernel releases. To properly fix this, please
follow the documented rules in the
Documentation/process/stable-kernel-rules.rst file for how to resolve
this.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
prev parent reply other threads:[~2025-04-02 8:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 8:06 [PATCH v3 0/1] usbnet:fix NPE during rx_complete Ying Lu
2025-04-02 8:06 ` [PATCH v3 1/1] " Ying Lu
2025-04-02 8:11 ` Greg KH [this message]
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=2025040218-uphill-mouth-c528@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=luying1@xiaomi.com \
--cc=luying526@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).