Skip to content

Commit 66cb618

Browse files
Epicuriusgregkh
authored andcommitted
usb: xhci: prevent potential failure in handle_tx_event() for Transfer events without TRB
Some transfer events don't always point to a TRB, and consequently don't have a endpoint ring. In these cases, function handle_tx_event() should not proceed, because if 'ep->skip' is set, the pointer to the endpoint ring is used. To prevent a potential failure and make the code logical, return after checking the completion code for a Transfer event without TRBs. 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 34b6719 commit 66cb618

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/usb/host/xhci-ring.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,16 +2625,17 @@ static int handle_tx_event(struct xhci_hcd *xhci,
26252625
else
26262626
xhci_handle_halted_endpoint(xhci, ep, NULL,
26272627
EP_SOFT_RESET);
2628-
goto cleanup;
2628+
break;
26292629
case COMP_RING_UNDERRUN:
26302630
case COMP_RING_OVERRUN:
26312631
case COMP_STOPPED_LENGTH_INVALID:
2632-
goto cleanup;
2632+
break;
26332633
default:
26342634
xhci_err(xhci, "ERROR Transfer event for unknown stream ring slot %u ep %u\n",
26352635
slot_id, ep_index);
26362636
goto err_out;
26372637
}
2638+
return 0;
26382639
}
26392640

26402641
/* Count current td numbers if ep->skip is set */

0 commit comments

Comments
 (0)