kernel_samsung_a53x/drivers/usb/host
Mathias Nyman e1f726d523 xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
commit af8e119f52e9c13e556be9e03f27957554a84656 upstream.

re-enumerating full-speed devices after a failed address device command
can trigger a NULL pointer dereference.

Full-speed devices may need to reconfigure the endpoint 0 Max Packet Size
value during enumeration. Usb core calls usb_ep0_reinit() in this case,
which ends up calling xhci_configure_endpoint().

On Panther point xHC the xhci_configure_endpoint() function will
additionally check and reserve bandwidth in software. Other hosts do
this in hardware

If xHC address device command fails then a new xhci_virt_device structure
is allocated as part of re-enabling the slot, but the bandwidth table
pointers are not set up properly here.
This triggers the NULL pointer dereference the next time usb_ep0_reinit()
is called and xhci_configure_endpoint() tries to check and reserve
bandwidth

[46710.713538] usb 3-1: new full-speed USB device number 5 using xhci_hcd
[46710.713699] usb 3-1: Device not responding to setup address.
[46710.917684] usb 3-1: Device not responding to setup address.
[46711.125536] usb 3-1: device not accepting address 5, error -71
[46711.125594] BUG: kernel NULL pointer dereference, address: 0000000000000008
[46711.125600] #PF: supervisor read access in kernel mode
[46711.125603] #PF: error_code(0x0000) - not-present page
[46711.125606] PGD 0 P4D 0
[46711.125610] Oops: Oops: 0000 [#1] PREEMPT SMP PTI
[46711.125615] CPU: 1 PID: 25760 Comm: kworker/1:2 Not tainted 6.10.3_2 #1
[46711.125620] Hardware name: Gigabyte Technology Co., Ltd.
[46711.125623] Workqueue: usb_hub_wq hub_event [usbcore]
[46711.125668] RIP: 0010:xhci_reserve_bandwidth (drivers/usb/host/xhci.c

Fix this by making sure bandwidth table pointers are set up correctly
after a failed address device command, and additionally by avoiding
checking for bandwidth in cases like this where no actual endpoints are
added or removed, i.e. only context for default control endpoint 0 is
evaluated.

Reported-by: Karel Balej <balejk@matfyz.cz>
Closes: https://lore.kernel.org/linux-usb/D3CKQQAETH47.1MUO22RTCH2O3@matfyz.cz/
Cc: stable@vger.kernel.org
Fixes: 651aaf36a7d7 ("usb: xhci: Handle USB transaction error on address command")
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240815141117.2702314-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:20:42 +01:00
..
bcma-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-atmel.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-brcm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-dbg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-exynos.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-fsl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-fsl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-grlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-hub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-mem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-mv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-mxc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-npcm7xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-omap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-orion.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-pci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-platform.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-pmcmsp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-ppc-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-ps3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-q.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-sched.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-sh.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-spear.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-st.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-sysfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-tegra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci-xilinx-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-dbg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-hub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-mem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-q.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-sched.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci-tds.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fhci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fotg210-hcd.c usb: fotg210-hcd: delete an incorrect bounds test 2024-11-18 12:12:02 +01:00
fotg210.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fsl-mph-dr-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx21-dbg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx21-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
imx21-hcd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isp116x-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isp116x.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isp1362-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isp1362.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
max3421-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-at91.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-da8xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-dbg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-exynos.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-hcd.c usb: ohci: Prevent missed ohci interrupts 2024-11-19 11:32:48 +01:00
ohci-hub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-mem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-nxp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-omap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-pci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-platform.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-ppc-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-ps3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-pxa27x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-q.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-s3c2410.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-sa1111.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-sm501.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-spear.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-st.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci-tmio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ohci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
oxu210hp-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci-quirks.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci-quirks.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r8a66597-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
r8a66597.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sl811-hcd.c usb: sl811-hcd: only defined function checkdone if QUIRK2 is defined 2024-11-19 09:23:15 +01:00
sl811.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sl811_cs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ssb-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
u132-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-debug.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-grlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-hcd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-hcd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-hub.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-pci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-platform.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uhci-q.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-dbg.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-dbgcap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-dbgcap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-dbgtty.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-debugfs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-debugfs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-ext-caps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-ext-caps.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-exynos.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-exynos.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-histb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-hub.c xhci: cleanup xhci_hub_control port references 2024-11-08 11:26:12 +01:00
xhci-mem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-mtk-sch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-mtk.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-mtk.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-mvebu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-mvebu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-pci-renesas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-pci.c xhci: Apply broken streams quirk to Etron EJ188 xHCI host 2024-11-19 14:19:02 +01:00
xhci-pci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-plat.c usb: host: xhci-plat: Add support for XHCI_SG_TRB_CACHE_SIZE_QUIRK 2024-11-18 12:13:26 +01:00
xhci-plat.h usb: xhci-plat: Don't include xhci.h 2024-11-19 11:32:48 +01:00
xhci-rcar.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-rcar.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-ring.c xhci: Set correct transferred length for cancelled bulk transfers 2024-11-19 14:19:02 +01:00
xhci-tegra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-trace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci-trace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xhci.c xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration 2024-11-23 23:20:42 +01:00
xhci.h xhci: process isoc TD properly when there was a transaction error mid TD. 2024-11-18 23:19:51 +01:00