]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: xhci: Remove skip_isoc_td()
authorMichal Pecio <michal.pecio@gmail.com>
Wed, 3 Jun 2026 09:11:21 +0000 (12:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jun 2026 17:23:28 +0000 (19:23 +0200)
This function is pointless because usb_submit_urb() initializes all
isoc frame descriptors to -EXDEV and 0 length so that HCDs don't need
to do anything with transfers which were never executed.

Other HCDs rely on this (e.g. EHCI itd_complete()), so we can too.
This gets rid of a potentially dangereous function which could corrupt
memory if we weren't super careful to only call it on isoc URBs.

Also, set status to 0 rather than any random status determined by the
later TD which caused skipping. This status will be ignored anyway.

Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260603091132.1110849-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci-ring.c

index f62db238276dee4affcaebf51d9c0652424e0795..1fbf43a5103799b535bf5dcac4046faa491cfa34 100644 (file)
@@ -2492,26 +2492,6 @@ finish_td:
        finish_td(xhci, ep, ep_ring, td, trb_comp_code);
 }
 
-static void skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
-                        struct xhci_virt_ep *ep, int status)
-{
-       struct urb_priv *urb_priv;
-       struct usb_iso_packet_descriptor *frame;
-       int idx;
-
-       urb_priv = td->urb->hcpriv;
-       idx = urb_priv->num_tds_done;
-       frame = &td->urb->iso_frame_desc[idx];
-
-       /* The transfer is partly done. */
-       frame->status = -EXDEV;
-
-       /* calc actual length */
-       frame->actual_length = 0;
-
-       xhci_dequeue_td(xhci, td, ep->ring, status);
-}
-
 /*
  * Process bulk and interrupt tds, update urb status and actual_length.
  */
@@ -2854,7 +2834,11 @@ static int handle_tx_event(struct xhci_hcd *xhci,
                                if (trb_comp_code == COMP_STOPPED_LENGTH_INVALID)
                                        return 0;
 
-                               skip_isoc_td(xhci, td, ep, status);
+                               /*
+                                * TD was missed, skip it. Core already initialized frame->status
+                                * to -EXDEV and frame->actual_length to 0, nothing more to do.
+                                */
+                               xhci_dequeue_td(xhci, td, ep_ring, 0);
 
                                if (!list_empty(&ep_ring->td_list)) {
                                        if (ring_xrun_event) {