Skip to content

Commit 8bf7e9a

Browse files
P33Mpopcornmix
authored andcommitted
usb: xhci: workaround for bogus SET_DEQ_PENDING endpoint state
See raspberrypi#3981 An unknown unsafe memory access can result in the ep_state variable in xhci_virt_ep being trampled with a stuck SET_DEQ_PENDING state despite successful completion of a Set TR Deq Pointer command. All URB enqueue/dequeue calls for the endpoint will fail in this state so no transfers are possible until the device is reconnected. As a workaround, clear the flag if we see it set and issue a new Set TR Deq command anyway - this should be harmless, as a prior Set TR Deq command will only have been issued in the Stopped state, and if the endpoint is Running then the controller is required to ignore it and respond with a Context State Error event TRB. Signed-off-by: Jonathan Bell <[email protected]>
1 parent 4730249 commit 8bf7e9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,9 +719,9 @@ static int xhci_move_dequeue_past_td(struct xhci_hcd *xhci,
719719
}
720720

721721
if ((ep->ep_state & SET_DEQ_PENDING)) {
722-
xhci_warn(xhci, "Set TR Deq already pending, don't submit for 0x%pad\n",
723-
&addr);
724-
return -EBUSY;
722+
xhci_warn(xhci, "WARN A Set TR Deq Ptr command is pending for slot %u ep %u\n",
723+
slot_id, ep_index);
724+
ep->ep_state &= ~SET_DEQ_PENDING;
725725
}
726726

727727
/* This function gets called from contexts where it cannot sleep */

0 commit comments

Comments
 (0)