path: root/drivers/usb
diff options
authorMathias Nyman <>2021-05-25 10:40:59 +0300
committerGreg Kroah-Hartman <>2021-05-25 10:21:47 +0200
commita80c203c3f1c06d2201c19ae071d0ae770a2b1ca (patch)
tree2177d7ccc10eed811dc673b6dc91058179db94f8 /drivers/usb
parente6809703e164e0e47d99a42084af06a60e386b13 (diff)
xhci: fix giving back URB with incorrect status regression in 5.12
5.12 kernel changes how xhci handles cancelled URBs and halted endpoints. Among these changes cancelled and stalled URBs are no longer given back before they are cleared from xHC hardware cache. These changes unfortunately cleared the -EPIPE status of a stalled transfer in one case before giving bak the URB, causing a USB card reader to fail from working. Fixes: 674f8438c121 ("xhci: split handling halted endpoints into two steps") Cc: <> # 5.12 Reported-by: Peter Ganzhorn <> Tested-by: Peter Ganzhorn <> Signed-off-by: Mathias Nyman <> Link: Signed-off-by: Greg Kroah-Hartman <>
Diffstat (limited to 'drivers/usb')
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index a8e4189277da..256d336354a0 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -828,14 +828,10 @@ static void xhci_giveback_invalidated_tds(struct xhci_virt_ep *ep)
list_for_each_entry_safe(td, tmp_td, &ep->cancelled_td_list,
cancelled_td_list) {
- /*
- * Doesn't matter what we pass for status, since the core will
- * just overwrite it (because the URB has been unlinked).
- */
ring = xhci_urb_to_transfer_ring(ep->xhci, td->urb);
if (td->cancel_status == TD_CLEARED)
- xhci_td_cleanup(ep->xhci, td, ring, 0);
+ xhci_td_cleanup(ep->xhci, td, ring, td->status);
if (ep->xhci->xhc_state & XHCI_STATE_DYING)