linux/drivers/usb
Michal Pecio 1e0a19912a usb: xhci: Fix NULL pointer dereference on certain command aborts
If a command is queued to the final usable TRB of a ring segment, the
enqueue pointer is advanced to the subsequent link TRB and no further.
If the command is later aborted, when the abort completion is handled
the dequeue pointer is advanced to the first TRB of the next segment.

If no further commands are queued, xhci_handle_stopped_cmd_ring() sees
the ring pointers unequal and assumes that there is a pending command,
so it calls xhci_mod_cmd_timer() which crashes if cur_cmd was NULL.

Don't attempt timer setup if cur_cmd is NULL. The subsequent doorbell
ring likely is unnecessary too, but it's harmless. Leave it alone.

This is probably Bug 219532, but no confirmation has been received.

The issue has been independently reproduced and confirmed fixed using
a USB MCU programmed to NAK the Status stage of SET_ADDRESS forever.
Everything continued working normally after several prevented crashes.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=219532
Fixes: c311e391a7 ("xhci: rework command timeout and cancellation,")
CC: stable@vger.kernel.org
Signed-off-by: Michal Pecio <michal.pecio@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20241227120142.1035206-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-12-27 13:06:10 +01:00
..
atm Merge 6.12-rc3 into usb-next 2024-10-14 08:03:44 +02:00
c67x00 usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
cdns3 usb: cdns3: Synchronise PCI IDs via common data base 2024-11-13 07:16:31 +01:00
chipidea usb: chipidea: host: Improve port index sanitizing 2024-12-04 16:11:58 +01:00
class USB: usblp: remove redundant semicolon 2024-12-23 18:40:39 +01:00
common usb: common: expand documentation for USB functions 2024-12-23 18:40:26 +01:00
core usb: core: sysfs: Constify 'struct bin_attribute' 2024-12-24 08:56:04 +01:00
dwc2 usb: dwc2: Fix HCD port connection race 2024-12-04 16:30:05 +01:00
dwc3 usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration 2024-12-24 08:56:05 +01:00
early
fotg210 Merge 6.12-rc3 into usb-next 2024-10-14 08:03:44 +02:00
gadget usb: gadget: f_tcm: Refactor goto check_condition 2024-12-24 08:56:08 +01:00
host usb: xhci: Fix NULL pointer dereference on certain command aborts 2024-12-27 13:06:10 +01:00
image scsi: core: Add a dma_alignment field to the host and host template 2024-04-11 21:37:48 -04:00
isp1760 Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
misc usb: misc: onboard_usb_dev: skip suspend/resume sequence for USB5744 SMBus support 2024-12-04 16:27:04 +01:00
mon drivers/usb/mon: refactor min with min_t 2024-11-13 15:09:51 +01:00
mtu3 Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
musb Kbuild updates for v6.13 2024-11-30 13:41:50 -08:00
phy usb: Use (of|device)_property_present() for non-boolean properties 2024-11-05 13:29:26 +01:00
renesas_usbhs usb: Use (of|device)_property_present() for non-boolean properties 2024-11-05 13:29:26 +01:00
roles usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
serial USB: serial: option: add Telit FE910C04 rmnet compositions 2024-12-11 10:37:28 +01:00
storage Merge 6.13-rc3 into usb-next 2024-12-16 16:23:12 +01:00
typec usb: typec: Print err when displayport fails to enter 2024-12-24 08:56:05 +01:00
usbip usbip: vudc: Constify 'struct bin_attribute' 2024-12-24 08:56:04 +01:00
Kconfig
Makefile USB: xen-hcd: Traverse host/ when CONFIG_USB_XEN_HCD is selected 2024-06-04 15:33:38 +02:00
usb-skeleton.c