[PATCH 1/5] usb: xhci: tolerate COMP_CTX_STATE in abort_td's final completion check

Stephano Cetola stephano at cetola.net
Sat Aug 22 15:34:00 PDT 2026


abort_td() issues a Stop Ring command followed by a Set TR Dequeue
Pointer command to cancel a pending transfer. The completion check
for the Stop Ring command already tolerates COMP_CTX_STATE as an
acceptable outcome alongside COMP_SUCCESS. The completion check for
the following Set TR Dequeue Pointer command did not, and hit its
BUG_ON when the endpoint had transitioned to a state where that
command legitimately returns COMP_CTX_STATE instead.

Signed-off-by: Stephano Cetola <stephano at cetola.net>
---
 drivers/usb/host/xhci-ring.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 00344e8074..bd38f0de91 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -594,9 +594,13 @@ static void abort_td(struct usb_device *udev, int ep_index)
 	if (!event)
 		return;
 
+	comp = GET_COMP_CODE(le32_to_cpu(event->event_cmd.status));
+	if (comp == COMP_CTX_STATE)
+		dev_dbg(ctrl->dev, "%s: Set TR Dequeue Pointer got CTX_STATE, endpoint was already in the target state\n",
+			__func__);
 	BUG_ON(TRB_TO_SLOT_ID(le32_to_cpu(event->event_cmd.flags))
-		!= udev->slot_id || GET_COMP_CODE(le32_to_cpu(
-		event->event_cmd.status)) != COMP_SUCCESS);
+		!= udev->slot_id || (comp != COMP_SUCCESS && comp
+		!= COMP_CTX_STATE));
 	xhci_acknowledge_event(ctrl);
 }
 

-- 
2.55.0




More information about the barebox mailing list