OrangePi_CM5/drivers/usb/host
William Wu 666bac0de5 FROMLIST: usb: xhci: account for num_trbs_free when invalidating TDs
If a ring has a number of TDs enqueued past the dequeue pointer, and the
URBs corresponding to these TDs are dequeued, then num_trbs_free isn't
updated to show that these TDs have been converted to no-ops and
effectively "freed". This means that num_trbs_free creeps downwards
until the count is exhausted, which then triggers xhci_ring_expansion()
and effectively leaks memory by infinitely growing the transfer ring.

This is commonly encounted through the use of a usb-serial port where
the port is repeatedly opened, read, then closed.

Move the num_trbs_free crediting out of the Set TR Dequeue Pointer
handling and into xhci_invalidate_cancelled_tds().

There is a potential for overestimating the actual space on the ring if
the ring is nearly full and TDs are arbitrarily enqueued by a device
driver while it is dequeueing them, but dequeues are usually batched
during device close/shutdown or endpoint error recovery.

Link: https://github.com/raspberrypi/linux/issues/5088
Change-Id: I858a32e6bcbb525cccff3a6d07fe77d2be67f5e7
Signed-off-by: William Wu <william.wu@rock-chips.com>
Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
2023-05-25 15:02:08 +08:00
..
Kconfig
…
Makefile
…
bcma-hcd.c USB: bcma: Make GPIO explicitly optional 2022-11-25 17:45:50 +01:00
ehci-atmel.c
…
ehci-brcm.c
…
ehci-dbg.c
…
ehci-exynos.c
…
ehci-fsl.c
…
ehci-fsl.h
…
ehci-grlib.c
…
ehci-hcd.c usb: host: ehci: clear interrupts when ehci has halted 2023-04-19 18:43:06 +08:00
ehci-hub.c
…
ehci-mem.c
…
ehci-mv.c
…
ehci-mxc.c
…
ehci-npcm7xx.c
…
ehci-omap.c
…
ehci-orion.c
…
ehci-pci.c usb: ehci: add pci device support for Aspeed platforms 2022-04-13 21:00:56 +02:00
ehci-platform.c usb: host: ehci-platform: fix companion-device leak for rockchip 2022-10-11 16:38:35 +08:00
ehci-pmcmsp.c
…
ehci-ppc-of.c usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe 2022-08-21 15:15:53 +02:00
ehci-ps3.c
…
ehci-q.c
…
ehci-sched.c
…
ehci-sh.c
…
ehci-spear.c
…
ehci-st.c
…
ehci-sysfs.c
…
ehci-tegra.c
…
ehci-timer.c
…
ehci-xilinx-of.c
…
ehci.h
…
fhci-dbg.c
…
fhci-hcd.c
…
fhci-hub.c
…
fhci-mem.c
…
fhci-q.c
…
fhci-sched.c
…
fhci-tds.c
…
fhci.h
…
fotg210-hcd.c
…
fotg210.h
…
fsl-mph-dr-of.c
…
imx21-dbg.c
…
imx21-hcd.c
…
imx21-hcd.h
…
isp116x-hcd.c USB: host: isp116x: check return value after calling platform_get_resource() 2022-06-14 18:32:42 +02:00
isp116x.h
…
isp1362-hcd.c
…
isp1362.h
…
max3421-hcd.c
…
ohci-at91.c
…
ohci-da8xx.c
…
ohci-dbg.c
…
ohci-exynos.c
…
ohci-hcd.c
…
ohci-hub.c
…
ohci-mem.c
…
ohci-nxp.c usb: ohci-nxp: Fix refcount leak in ohci_hcd_nxp_probe 2022-08-21 15:15:53 +02:00
ohci-omap.c
…
ohci-pci.c
…
ohci-platform.c
…
ohci-ppc-of.c usb: host: ohci-ppc-of: Fix refcount leak bug 2022-08-25 11:38:13 +02:00
ohci-ps3.c
…
ohci-pxa27x.c
…
ohci-q.c
…
ohci-s3c2410.c
…
ohci-sa1111.c
…
ohci-sm501.c
…
ohci-spear.c
…
ohci-st.c
…
ohci-tmio.c
…
ohci.h
…
oxu210hp-hcd.c drivers: usb: host: Fix deadlock in oxu_bus_suspend() 2022-06-14 18:32:42 +02:00
pci-quirks.c
…
pci-quirks.h
…
r8a66597-hcd.c
…
r8a66597.h
…
sl811-hcd.c
…
sl811.h
…
sl811_cs.c
…
ssb-hcd.c
…
u132-hcd.c
…
uhci-debug.c
…
uhci-grlib.c
…
uhci-hcd.c
…
uhci-hcd.h
…
uhci-hub.c
…
uhci-pci.c
…
uhci-platform.c usb: uhci: add aspeed ast2600 uhci support 2022-01-27 10:54:14 +01:00
uhci-q.c
…
xhci-dbg.c
…
xhci-dbgcap.c
…
xhci-dbgcap.h
…
xhci-dbgtty.c
…
xhci-debugfs.c
…
xhci-debugfs.h
…
xhci-ext-caps.c
…
xhci-ext-caps.h
…
xhci-histb.c
…
xhci-hub.c Merge tag 'android12-5.10-2023-02_r1' of https://android.googlesource.com/kernel/common 2023-03-14 09:44:51 +08:00
xhci-mem.c This is the 5.10.153 stable release 2022-11-21 15:47:06 +00:00
xhci-mtk-sch.c This is the 5.10.146 stable release 2022-09-29 17:06:30 +02:00
xhci-mtk.c
…
xhci-mtk.h This is the 5.10.146 stable release 2022-09-29 17:06:30 +02:00
xhci-mvebu.c
…
xhci-mvebu.h
…
xhci-pci-renesas.c
…
xhci-pci.c UPSTREAM: xhci: Apply XHCI_RESET_TO_DEFAULT quirk to ADL-N 2023-02-06 11:31:35 +00:00
xhci-pci.h
…
xhci-plat.c Merge tag 'android12-5.10-2023-02_r1' of https://android.googlesource.com/kernel/common 2023-03-14 09:44:51 +08:00
xhci-plat.h
…
xhci-rcar.c
…
xhci-rcar.h
…
xhci-ring.c FROMLIST: usb: xhci: account for num_trbs_free when invalidating TDs 2023-05-25 15:02:08 +08:00
xhci-tegra.c usb: xhci: tegra: Fix error check 2022-08-21 15:15:54 +02:00
xhci-trace.c
…
xhci-trace.h
…
xhci.c This is the 5.10.153 stable release 2022-11-21 15:47:06 +00:00
xhci.h Merge tag 'android12-5.10-2023-02_r1' of https://android.googlesource.com/kernel/common 2023-03-14 09:44:51 +08:00