usb: dwc3: Reset num_trbs after skipping
authorThinh Nguyen <thinh.nguyen@synopsys.com>
Wed, 13 Feb 2019 03:39:27 +0000 (19:39 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2019 11:14:49 +0000 (13:14 +0200)
commit9c423fd89a2b8624ca0a0eb2a1bd440ad0db8cf5
treecc58d2e49b42c65c81ad304372b031a2a48c010f
parent2bbb6b547fbe43cf6cbfdbb9e964c4ca51fed8eb
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 <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: Sasha Levin <sashal@kernel.org>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c