Skip to content

Commit d8eca64

Browse files
Felipe Balbigregkh
authored andcommitted
usb: dwc3: gadget: fix race when disabling ep with cancelled xfers
When disabling an endpoint which has cancelled requests, we should make sure to giveback requests that are currently pending in the cancelled list, otherwise we may fall into a situation where command completion interrupt fires after endpoint has been disabled, therefore causing a splat. Fixes: fec9095 "usb: dwc3: gadget: remove wait_end_transfer" Reported-by: Roger Quadros <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 94e259f commit d8eca64

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,12 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
707707

708708
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
709709
}
710+
711+
while (!list_empty(&dep->cancelled_list)) {
712+
req = next_request(&dep->cancelled_list);
713+
714+
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
715+
}
710716
}
711717

712718
/**

0 commit comments

Comments
 (0)