Skip to content

Commit 132dcf6

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: remove infinite loop prevention
If a buggy HW reports some unpredicted event (for example, an overrun event following a MSE event while the EP ring is actually not empty), the driver will never find the TD, and it will loop until the TD list is empty. Before commits [1][2], the spin lock was released when giving back a URB in the do-while loop. This could cause more TD to be added to TD list, causing an infinite loop. Because of commits [1][2] the spin lock is not released any more, thus the infinite loop prevention is unnecessary and is removed. [1], commit 0c03d89 ("xhci: Giveback urb in finish_td directly") [2], commit 36dc016 ("usb: host: xhci: Support running urb giveback in tasklet context") Signed-off-by: Niklas Neronin <[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 5ea8a88 commit 132dcf6

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,7 +2611,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
26112611
int status = -EINPROGRESS;
26122612
struct xhci_ep_ctx *ep_ctx;
26132613
u32 trb_comp_code;
2614-
int td_num = 0;
26152614

26162615
slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));
26172616
ep_index = TRB_TO_EP_ID(le32_to_cpu(event->flags)) - 1;
@@ -2637,10 +2636,6 @@ static int handle_tx_event(struct xhci_hcd *xhci,
26372636
if (!ep_ring)
26382637
return handle_transferless_tx_event(xhci, ep, trb_comp_code);
26392638

2640-
/* Count current td numbers if ep->skip is set */
2641-
if (ep->skip)
2642-
td_num += list_count_nodes(&ep_ring->td_list);
2643-
26442639
/* Look for common error cases */
26452640
switch (trb_comp_code) {
26462641
/* Skip codes that require special handling depending on
@@ -2799,18 +2794,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
27992794
return 0;
28002795
}
28012796

2802-
/* We've skipped all the TDs on the ep ring when ep->skip set */
2803-
if (ep->skip && td_num == 0) {
2804-
ep->skip = false;
2805-
xhci_dbg(xhci, "All tds on the ep_ring skipped. Clear skip flag for slot %u ep %u.\n",
2806-
slot_id, ep_index);
2807-
return 0;
2808-
}
2809-
28102797
td = list_first_entry(&ep_ring->td_list, struct xhci_td,
28112798
td_list);
2812-
if (ep->skip)
2813-
td_num--;
28142799

28152800
/* Is this a TRB in the currently executing TD? */
28162801
ep_seg = trb_in_td(xhci, td, ep_trb_dma, false);

0 commit comments

Comments
 (0)