]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
usb: dwc3: gadget: Properly check last unaligned/zero chain TRB
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Fri, 3 Aug 2018 03:17:16 +0000 (20:17 -0700)
committerSultan Alsawaf <sultan.alsawaf@canonical.com>
Wed, 24 Jul 2019 15:44:50 +0000 (09:44 -0600)
commit29f200038875b347331e70ebb5ef49e5e5cf3054
tree5fe87e51a0d24e59c7605916a2e8c2bf346930b8
parent1d7a718e2dccfbf82c56084e56888d6ba2ffdb55
usb: dwc3: gadget: Properly check last unaligned/zero chain TRB

BugLink: https://bugs.launchpad.net/bugs/1836968
commit ba3a51ac32ebcf8d0a54b37f1af268ad8a31c52f upstream.

Current check for the last extra TRB for zero and unaligned transfers
does not account for isoc OUT. The last TRB of the Buffer Descriptor for
isoc OUT transfers will be retired with HWO=0. As a result, we won't
return early. The req->remaining will be updated to include the BUFSIZ
count of the extra TRB, and the actual number of transferred bytes
calculation will be wrong.

To fix this, check whether it's a short or zero packet and the last TRB
chain bit to return early.

Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/usb/dwc3/gadget.c