kernel_samsung_a53x/drivers/usb/dwc3
Thinh Nguyen df54057156 usb: dwc3: gadget: Fix checking for number of TRBs left
commit 02a6982b0ccfcdc39e20016f5fc9a1b7826a6ee7 upstream.

The check whether the TRB ring is full or empty in dwc3_calc_trbs_left()
is insufficient. It assumes there are active TRBs if there's any request
in the started_list. However, that's not the case for requests with a
large SG list.

That is, if we have a single usb request that requires more TRBs than
the total TRBs in the TRB ring, the queued TRBs will be available when
all the TRBs in the ring are completed. But the request is only
partially completed and remains in the started_list. With the current
logic, the TRB ring is empty, but dwc3_calc_trbs_left() returns 0.

Fix this by additionally checking for the request->num_trbs for active
TRB count.

Cc: stable@vger.kernel.org
Fixes: 51f1954ad853 ("usb: dwc3: gadget: Fix dwc3_calc_trbs_left()")
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/708dc62b56b77da1f704cc2ae9b6ddb1f2dbef1f.1731545781.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-17 13:24:20 +01:00
..
core-exynos.h
core.c Revert "usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after resume bug" 2024-11-24 00:23:36 +01:00
core.h Revert "usb: dwc3: core: Enable GUCTL1 bit 10 for fixing termination error after resume bug" 2024-11-24 00:23:36 +01:00
debug.h
debugfs.c
drd.c usb: dwc3: Fix default mode initialization 2024-11-18 12:10:58 +01:00
dwc3-exynos-otg.c
dwc3-exynos.c
dwc3-exynos.h
dwc3-haps.c
dwc3-imx8mp.c
dwc3-keystone.c
dwc3-meson-g12a.c
dwc3-of-simple.c
dwc3-omap.c usb: dwc3: omap: add missing depopulate in probe error path 2024-11-23 23:20:55 +01:00
dwc3-pci.c
dwc3-qcom.c USB: dwc3: qcom: fix wakeup after probe deferral 2024-11-18 12:11:08 +01:00
dwc3-st.c usb: dwc3: st: add missing depopulate in probe error path 2024-11-23 23:20:55 +01:00
ep0.c usb: dwc: ep0: Update request status in dwc3_ep0_stall_restart 2024-11-18 12:12:46 +01:00
exynos-otg.h
exynos_usb_tpmon.c
exynos_usb_tpmon.h
gadget.c usb: dwc3: gadget: Fix checking for number of TRBs left 2024-12-17 13:24:20 +01:00
gadget.h
host.c
io.h
Kconfig
Makefile
trace.c
trace.h
ulpi.c