Skip to content

Commit 7c4650d

Browse files
Michal Peciogregkh
authored andcommitted
xhci: handle isoc Babble and Buffer Overrun events properly
xHCI 4.9 explicitly forbids assuming that the xHC has released its ownership of a multi-TRB TD when it reports an error on one of the early TRBs. Yet the driver makes such assumption and releases the TD, allowing the remaining TRBs to be freed or overwritten by new TDs. The xHC should also report completion of the final TRB due to its IOC flag being set by us, regardless of prior errors. This event cannot be recognized if the TD has already been freed earlier, resulting in "Transfer event TRB DMA ptr not part of current TD" error message. Fix this by reusing the logic for processing isoc Transaction Errors. This also handles hosts which fail to report the final completion. Fix transfer length reporting on Babble errors. They may be caused by device malfunction, no guarantee that the buffer has been filled. Signed-off-by: Michal Pecio <[email protected]> Cc: [email protected] Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5372c65 commit 7c4650d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2394,9 +2394,13 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep,
23942394
case COMP_BANDWIDTH_OVERRUN_ERROR:
23952395
frame->status = -ECOMM;
23962396
break;
2397-
case COMP_ISOCH_BUFFER_OVERRUN:
23982397
case COMP_BABBLE_DETECTED_ERROR:
2398+
sum_trbs_for_length = true;
2399+
fallthrough;
2400+
case COMP_ISOCH_BUFFER_OVERRUN:
23992401
frame->status = -EOVERFLOW;
2402+
if (ep_trb != td->last_trb)
2403+
td->error_mid_td = true;
24002404
break;
24012405
case COMP_INCOMPATIBLE_DEVICE_ERROR:
24022406
case COMP_STALL_ERROR:

0 commit comments

Comments
 (0)