usb: dwc3: gadget: Wrap around when skip TRBs
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Thu, 5 Mar 2020 21:24:01 +0000 (13:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 13 Apr 2020 11:16:34 +0000 (13:16 +0200)
commit0ac798074dfd5273e5f514e634bb9effbf5ebafd
treeccda29ad34a6a0d56d0c3202ec7d6918c5f6c2b0
parent2a00767b35c3536602f94e27e0e3faa7819b22c7
usb: dwc3: gadget: Wrap around when skip TRBs

commit 2dedea035ae82c5af0595637a6eda4655532b21e upstream.

When skipping TRBs, we need to account for wrapping around the ring
buffer and not modifying some invalid TRBs. Without this fix, dwc3 won't
be able to check for available TRBs.

Cc: stable <stable@vger.kernel.org>
Fixes: 7746a8dfb3f9 ("usb: dwc3: gadget: extract dwc3_gadget_ep_skip_trbs()")
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c