Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 14184f9b authored by Andiry Xu's avatar Andiry Xu Committed by Greg Kroah-Hartman
Browse files

USB: xHCI: update ring dequeue pointer when process missed tds



This patch fixes a isoc transfer bug reported by Sander Eikelenboom.
When ep->skip is set, endpoint ring dequeue pointer should be updated
when processed every missed td. Although ring dequeue pointer will also
be updated when ep->skip is clear, leave it intact during missed tds
processing may cause two issues:

1). If the very next valid transfer following missed tds is a short
transfer, its actual_length will be miscalculated;
2). If there are too many missed tds during transfer, new inserted tds
may found the transfer ring full and urb enqueue fails.

Reported-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
Tested-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: default avatarAndiry Xu <andiry.xu@amd.com>
Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a1669b2c
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1551,6 +1551,10 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
	/* calc actual length */
	if (ep->skip) {
		td->urb->iso_frame_desc[idx].actual_length = 0;
		/* Update ring dequeue pointer */
		while (ep_ring->dequeue != td->last_trb)
			inc_deq(xhci, ep_ring, false);
		inc_deq(xhci, ep_ring, false);
		return finish_td(xhci, td, event_trb, event, ep, status, true);
	}