Skip to content

Fix problems on disconnected devices in 7.3

Michal Pecio linux-usb lkml regressions 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4usb: xhci: Fix TD invalidation on disconnected endpointsdrivers/usb/host/xhci-ring.c+6 -60 replies
2/4usb: xhci: Give back stranded URBs on disconnected endpointsdrivers/usb/host/xhci-ring.c+20 -00 replies
3/4usb: xhci: Give back URBs on halted disconnected endpointsdrivers/usb/host/xhci-ring.c+11 -40 replies
4/4usb: xhci: Reject URBs to disconnected devicesdrivers/usb/host/xhci.c+7 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] Fix problems on disconnected devices in 7.3
Quoted 6 lines · Michal Pecio

Anyway, I think it all can be done with a bit less code, while also handling disconnection during unlink. Particularly on EP0, multiple URBs may be submitted by different drivers and/or userspace. Just because one of them unlinks its URB doesn't mean that the others are aware of anything being wrong and won't stall for <N> seconds.

Quoted 7 lines

This below is a rudimentarily tested RFC but it seems to work. It's simple enough that hopefully it might even be correct. I will test it more and write a changelog later today if there are no objections.

I tweaked the logic to return everything with -ESHUTDOWN and not bother to assign proper status to the URB which halted. Intuition:
we want them to give up, not call clear_halt() or reset_device().

Actually, wouldn't this break the "resuscitation" feature? Does anyone depend on it? Hell knows... I changed to give back the halted URB with normal status and ended up with similar code as everyone else, but in different places, so that URBs should also be flushed on unlink now. Took a little longer than I hoped.

Is the last patch 4/4 necessary in practice? I guess it probably is.

As for disconnection of USB3 NICs from Renesas, that still works without hanging the HC. In fact, we could even Reset EP and Set Deq on the interrupt endpoint and nothing happens if it's not restarted, but these patches here only clean up EP0.

Regards,
Michal