2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/usb/dwc3
SCHNEIDER Johannes 80e0839437 usb: dwc3: gadget: Fix TRB reclaim logic for short transfers and ZLPs
Commit 96c7bf8f6b3e ("usb: dwc3: gadget: Cleanup SG handling") updated
the TRB reclaim path to use the TRB CHN (Chain) bit to determine whether
a TRB was part of a chain. However, this inadvertently changed the
behavior of reclaiming the final TRB in some scatter-gather or short
transfer cases.

In particular, if the final TRB did not have the CHN bit set, the
cleanup path could incorrectly skip clearing the HWO (Hardware Own)
bit, leaving stale TRBs in the ring. This resulted in broken data
transfer completions in userspace, notably for MTP over FunctionFS.

Fix this by unconditionally clearing the HWO bit during TRB reclaim,
regardless of the CHN bit state. This restores correct behavior
especially for transfers that require ZLPs or end on non-CHN TRBs.

Fixes: 61440628a4 ("usb: dwc3: gadget: Cleanup SG handling")
Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: stable <stable@kernel.org>
Link: https://lore.kernel.org/r/AM8PR06MB7521A29A8863C838B54987B6BC7BA@AM8PR06MB7521.eurprd06.prod.outlook.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-06-28 17:19:56 +02:00
..
core.c usb: dwc3: Abort suspend on soft disconnect failure 2025-06-19 12:34:39 +02:00
core.h Merge 6.15-rc6 into usb-next 2025-05-13 08:26:58 +02:00
debug.h usb: dwc3: Add function suspend and function wakeup support 2023-03-29 10:27:01 +02:00
debugfs.c usb: dwc3: debugfs: Resume dwc3 before accessing registers 2023-05-13 17:56:22 +09:00
drd.c usb: dwc3: Set SUSPENDENABLE soon after phy init 2025-03-04 06:26:58 +01:00
dwc3-am62.c USB: dwc3: Use syscon_regmap_lookup_by_phandle_args 2025-02-14 09:29:32 +01:00
dwc3-exynos.c usb: dwc3-exynos: add support for ExynosAutov920 2025-05-21 13:12:43 +02:00
dwc3-haps.c usb: dwc3: haps: Constify the software node 2021-02-04 15:42:06 +01:00
dwc3-imx8mp.c usb: dwc3: imx8mp: fix software node kernel dump 2024-12-04 16:26:30 +01:00
dwc3-keystone.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
dwc3-meson-g12a.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
dwc3-octeon.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
dwc3-of-simple.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
dwc3-omap.c usb: dwc3: omap: Fix devm_regulator_get_optional() error handling 2025-01-11 17:02:30 +01:00
dwc3-pci.c usb: dwc3: gadget: Avoid using reserved endpoints on Intel Merrifield 2025-02-14 09:29:20 +01:00
dwc3-qcom-legacy.c usb: dwc3: qcom: Snapshot driver for backwards compatibilty 2025-04-15 14:29:19 +02:00
dwc3-qcom.c usb: dwc3: qcom: Use bulk clock API and devres 2025-05-21 13:10:23 +02:00
dwc3-rtk.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
dwc3-st.c usb: dwc3: Don't use %pK through printk 2025-03-14 09:17:30 +01:00
dwc3-xilinx.c usb: dwc3: xilinx: Prevent spike in reset signal 2025-04-11 16:21:03 +02:00
ep0.c usb: dwc3: ep0: Don't clear ep0 DWC3_EP_TRANSFER_STARTED 2024-11-16 09:04:56 +01:00
gadget.c usb: dwc3: gadget: Fix TRB reclaim logic for short transfers and ZLPs 2025-06-28 17:19:56 +02:00
gadget.h Merge 6.8-rc5 into usb-next 2024-02-19 09:13:29 +01:00
glue.h usb: dwc3: core: Don't touch resets and clocks 2025-04-15 14:29:19 +02:00
host.c usb: dwc3: Specify maximum number of XHCI interrupters 2025-04-11 13:02:30 +02:00
io.h usb: dwc3: fix incorrect kernel-doc comment syntax in files 2021-04-02 15:20:51 +02:00
Kconfig usb: use "prompt" instead of "bool" for choice prompts 2024-11-04 17:53:09 +09:00
Makefile usb: dwc3: qcom: Snapshot driver for backwards compatibilty 2025-04-15 14:29:19 +02:00
trace.c usb: dwc3: fix incorrect kernel-doc comment syntax in files 2021-04-02 15:20:51 +02:00
trace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
ulpi.c usb: dwc3: ulpi: Fix USB2.0 HS/FS/LS PHY suspend regression 2020-12-28 15:55:44 +01:00