* [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown
@ 2026-11-29 10:53 Felipe Infante de Castro
2026-11-29 12:14 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Infante de Castro @ 2026-11-29 10:53 UTC (permalink / raw)
To: Thinh Nguyen, Greg Kroah-Hartman
Cc: Bjorn Andersson, Konrad Dybcio, linux-usb, linux-arm-msm
Hi Thinh, Greg, Bjorn, and Konrad,
While bringing up an out-of-tree USB4 host router driver on a Snapdragon
X Elite laptop (Linux v7.3.6 arm64), we hit a reproducible (3/3) PID 1
kernel panic on reboot with a USB4 dock attached.
Scope note upfront: nothing in mainline Linux triggers this today. It
requires a second driver that unbinds a bound dwc3-qcom device during
system shutdown (which our USB4 host router driver initially did when
tearing down its guest USB3 session). We have already fixed our USB4
driver to skip device_release_driver() during shutdown, so this is
purely a hardening note for dwc3-qcom in case it is useful upstream.
What happened:
1. dwc3-qcom wires .shutdown = dwc3_qcom_remove.
2. When dwc3-qcom is re-bound as a guest after the USB4 router starts,
it sits later on devices_kset, so device_shutdown() invokes
dwc3_qcom_remove() on it *before* the USB4 router's .shutdown().
3. dwc3_qcom_remove() tears down dwc3_qcom and clears
dev_set_drvdata(dev, NULL), while leaving dev->driver bound (normal
for Linux ->shutdown()).
4. When the USB4 router's .shutdown() then called
device_release_driver() on the guest dwc3-qcom device, driver core
saw dev->driver still set and called dwc3_qcom_remove() a second time
with NULL drvdata, faulting at fffffffffffffff0 (-0x10) in PID 1:
Unable to handle kernel paging request at virtual address fffffffffffffff0
pc : dwc3_qcom_remove+0x28/0x168 [dwc3_qcom]
...
device_shutdown / kernel_restart
Kernel panic - not syncing: Attempted to kill init!
Hardening thought:
Guarding dwc3_qcom_remove() with `if (!qcom) return;` (or using a
dedicated idempotent .shutdown callback) would make dwc3-qcom safe
against any future driver-core or parent-triggered teardown running
after ->shutdown().
Details:
https://github.com/fidecastro/surface-laptop-7-15in-facts/blob/main/upstream-reports/dwc3-qcom-shutdown.md
Best regards,
Felipe Infante de Castro
Signed-off-by: Felipe Infante de Castro <felipe.infante.de.castro@gmail.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown
2026-11-29 10:53 [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown Felipe Infante de Castro
@ 2026-11-29 12:14 ` Greg Kroah-Hartman
2026-11-29 16:32 ` Felipe Infante de Castro
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-29 12:14 UTC (permalink / raw)
To: Felipe Infante de Castro
Cc: Thinh Nguyen, Bjorn Andersson, Konrad Dybcio, linux-usb,
linux-arm-msm
On Sun, Nov 29, 2026 at 05:53:07AM -0500, Felipe Infante de Castro wrote:
> Hi Thinh, Greg, Bjorn, and Konrad,
>
> While bringing up an out-of-tree USB4 host router driver on a Snapdragon
> X Elite laptop (Linux v7.3.6 arm64), we hit a reproducible (3/3) PID 1
> kernel panic on reboot with a USB4 dock attached.
>
> Scope note upfront: nothing in mainline Linux triggers this today. It
> requires a second driver that unbinds a bound dwc3-qcom device during
> system shutdown (which our USB4 host router driver initially did when
> tearing down its guest USB3 session). We have already fixed our USB4
> driver to skip device_release_driver() during shutdown, so this is
> purely a hardening note for dwc3-qcom in case it is useful upstream.
Then send a patch for the issue when your out-of-tree code is submitted.
We really don't care, nor could we even possibly consider, interactions
with out-of-tree code like this as that would mean we would go crazy
over time.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown
2026-11-29 12:14 ` Greg Kroah-Hartman
@ 2026-11-29 16:32 ` Felipe Infante de Castro
2026-11-29 16:41 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Felipe Infante de Castro @ 2026-11-29 16:32 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Thinh Nguyen, Bjorn Andersson, Konrad Dybcio, linux-usb,
linux-arm-msm
Understood, thanks. I will bring it up with the driver if it is ever
submitted.
Felipe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown
2026-11-29 16:32 ` Felipe Infante de Castro
@ 2026-11-29 16:41 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-29 16:41 UTC (permalink / raw)
To: Felipe Infante de Castro
Cc: Thinh Nguyen, Bjorn Andersson, Konrad Dybcio, linux-usb,
linux-arm-msm
On Sun, Nov 29, 2026 at 11:32:38AM -0500, Felipe Infante de Castro wrote:
> Understood, thanks. I will bring it up with the driver if it is ever
> submitted.
Sorry, I have no context here :(
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-29 16:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 10:53 [NOTE] usb: dwc3: qcom: .shutdown = dwc3_qcom_remove double-remove hazard on guest unbind during shutdown Felipe Infante de Castro
2026-11-29 12:14 ` Greg Kroah-Hartman
2026-11-29 16:32 ` Felipe Infante de Castro
2026-11-29 16:41 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox