public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Dayu Jiang <jiangdayu@xiaomi.com>
Cc: Kuen-Han Tsai <khtsai@google.com>,
	David Brownell <dbrownell@users.sourceforge.net>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_ether: Fix race between gether_disconnect and eth_stop
Date: Thu, 26 Mar 2026 11:35:31 +0100	[thread overview]
Message-ID: <2026032614-most-opposing-4363@gregkh> (raw)
In-Reply-To: <acTl6bUJTQp6kjCO@oa-jiangdayu.localdomain>

On Thu, Mar 26, 2026 at 03:53:13PM +0800, Dayu Jiang wrote:
> On Wed, Mar 11, 2026 at 05:12:15PM +0800, Kuen-Han Tsai wrote:
> > A race condition between gether_disconnect() and eth_stop() leads to a
> > NULL pointer dereference. Specifically, if eth_stop() is triggered
> > concurrently while gether_disconnect() is tearing down the endpoints,
> > eth_stop() attempts to access the cleared endpoint descriptor, causing
> > the following NPE:
> > 
> >   Unable to handle kernel NULL pointer dereference
> >   Call trace:
> >    __dwc3_gadget_ep_enable+0x60/0x788
> >    dwc3_gadget_ep_enable+0x70/0xe4
> >    usb_ep_enable+0x60/0x15c
> >    eth_stop+0xb8/0x108
> > 
> > Because eth_stop() crashes while holding the dev->lock, the thread
> > running gether_disconnect() fails to acquire the same lock and spins
> > forever, resulting in a hardlockup:
> > 
> >   Core - Debugging Information for Hardlockup core(7)
> >   Call trace:
> >    queued_spin_lock_slowpath+0x94/0x488
> >    _raw_spin_lock+0x64/0x6c
> >    gether_disconnect+0x19c/0x1e8
> >    ncm_set_alt+0x68/0x1a0
> >    composite_setup+0x6a0/0xc50
> >
> Hi Greg,
> Hit the same issue during NCM switch stress test.
> Can you take a look at this patch and check if it’s ready for merge?

This is already in my tree and in linux-next and will go to Linus this
weekend.

thanks,

greg k-h

  reply	other threads:[~2026-03-26 10:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11  9:12 [PATCH] usb: gadget: u_ether: Fix race between gether_disconnect and eth_stop Kuen-Han Tsai
2026-03-26  7:10 ` Dayu Jiang
2026-03-26  7:16 ` Dayu Jiang
2026-03-26  7:53 ` Dayu Jiang
2026-03-26 10:35   ` Greg Kroah-Hartman [this message]
2026-03-27  2:52     ` Dayu Jiang
2026-03-26 12:58 ` Dayu Jiang
2026-03-26 13:13 ` Dayu Jiang
2026-03-27  2:36 ` Dayu Jiang
2026-03-27  2:44 ` Dayu Jiang

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=2026032614-most-opposing-4363@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=dbrownell@users.sourceforge.net \
    --cc=jiangdayu@xiaomi.com \
    --cc=khtsai@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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