From: Chien Kun Niu <rickyniu@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Mathias Nyman <mathias.nyman@intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Chien Kun Niu <rickyniu@google.com>
Subject: [PATCH 0/2] usb: Fix giveback_urb_bh deadlock on URB dequeue
Date: Fri, 13 Nov 2026 04:02:37 +0000 [thread overview]
Message-ID: <20261113041948.1280304-1-rickyniu@google.com> (raw)
We hit a CPU hardlockup during reboot while usbnet was unlinking
queued RX URBs on a halted xHCI controller.
In xhci_urb_dequeue(), the err_giveback path releases xhci->lock and
restores interrupts before calling usb_hcd_giveback_urb(). Because
usb_hcd_giveback_urb() takes bh->lock with plain spin_lock(), an
interrupt arriving on the same CPU can deadlock on bh->lock either in
usb_hcd_irq() or when softirq runs usb_giveback_urb_bh().
Patch 1 switches usb_hcd_giveback_urb() to spin_lock_irqsave() since
bh->lock is also acquired in hardirq and BH contexts.
Patch 2 keeps xhci->lock held across usb_hcd_giveback_urb() in
xhci_urb_dequeue(), matching xhci_giveback_urb_in_irq() and keeping
per-endpoint URB giveback ordering serialized.
The two patches are independent and can be applied in either order.
Chien Kun Niu (2):
usb: core: hcd: Disable IRQs when taking bh->lock
xhci: Give back URB under lock in xhci_urb_dequeue()
drivers/usb/core/hcd.c | 5 +++--
drivers/usb/host/xhci.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
--
2.56.0.567.gdb80ae8cd5-goog
next reply other threads:[~2026-11-13 4:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 4:02 Chien Kun Niu [this message]
2026-11-13 4:02 ` [PATCH 1/2] usb: core: hcd: Disable IRQs when taking bh->lock Chien Kun Niu
2026-11-13 4:27 ` sashiko-bot
2026-11-13 4:02 ` [PATCH 2/2] xhci: Give back URB under lock in xhci_urb_dequeue() Chien Kun Niu
2026-11-13 4:27 ` sashiko-bot
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=20261113041948.1280304-1-rickyniu@google.com \
--to=rickyniu@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=stern@rowland.harvard.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.