Skip to content

Commit f78961f

Browse files
Thinh Nguyengregkh
authored andcommitted
usb: dwc3: gadget: Stop processing more requests on IMI
When servicing a transfer completion event, the dwc3 driver will reclaim TRBs of started requests up to the request associated with the interrupt event. Currently we don't check for interrupt due to missed isoc, and the driver may attempt to reclaim TRBs beyond the associated event. This causes invalid memory access when the hardware still owns the TRB. If there's a missed isoc TRB with IMI (interrupt on missed isoc), make sure to stop servicing further. Note that only the last TRB of chained TRBs has its status updated with missed isoc. Fixes: 72246da ("usb: Introduce DesignWare USB3 DRD Driver") Cc: [email protected] Reported-by: Jeff Vanhoof <[email protected]> Reported-by: Dan Vacura <[email protected]> Signed-off-by: Thinh Nguyen <[email protected]> Reviewed-by: Jeff Vanhoof <[email protected]> Tested-by: Jeff Vanhoof <[email protected]> Link: https://lore.kernel.org/r/b29acbeab531b666095dfdafd8cb5c7654fbb3e1.1666735451.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 88c8e05 commit f78961f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3248,6 +3248,10 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
32483248
if (event->status & DEPEVT_STATUS_SHORT && !chain)
32493249
return 1;
32503250

3251+
if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) &&
3252+
DWC3_TRB_SIZE_TRBSTS(trb->size) == DWC3_TRBSTS_MISSED_ISOC)
3253+
return 1;
3254+
32513255
if ((trb->ctrl & DWC3_TRB_CTRL_IOC) ||
32523256
(trb->ctrl & DWC3_TRB_CTRL_LST))
32533257
return 1;

0 commit comments

Comments
 (0)