From: Thinh Nguyen Date: Wed, 13 Feb 2019 03:39:27 +0000 (-0800) Subject: usb: dwc3: Reset num_trbs after skipping X-Git-Tag: v4.19.57~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c423fd89a2b8624ca0a0eb2a1bd440ad0db8cf5;p=platform%2Fkernel%2Flinux-rpi.git usb: dwc3: Reset num_trbs after skipping commit c7152763f02e05567da27462b2277a554e507c89 upstream. Currently req->num_trbs is not reset after the TRBs are skipped and processed from the cancelled list. The gadget driver may reuse the request with an invalid req->num_trbs, and DWC3 will incorrectly skip trbs. To fix this, simply reset req->num_trbs to 0 after skipping through all of them. Fixes: c3acd5901414 ("usb: dwc3: gadget: use num_trbs when skipping TRBs on ->dequeue()") Signed-off-by: Thinh Nguyen Signed-off-by: Felipe Balbi Cc: Sasha Levin Cc: John Stultz Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index e7122b5..e7461c9 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1361,6 +1361,8 @@ static void dwc3_gadget_ep_skip_trbs(struct dwc3_ep *dep, struct dwc3_request *r trb->ctrl &= ~DWC3_TRB_CTRL_HWO; dwc3_ep_inc_deq(dep); } + + req->num_trbs = 0; } static void dwc3_gadget_ep_cleanup_cancelled_requests(struct dwc3_ep *dep)