Go to file
Weitao Wang c78c8e5048 usb: xhci: Fix slot_id resource race conflict
[ Upstream commit 2eb0337615 ]

xHC controller may immediately reuse a slot_id after it's disabled,
giving it to a new enumerating device before the xhci driver freed
all resources related to the disabled device.

In such a scenario, device-A with slot_id equal to 1 is disconnecting
while device-B is enumerating, device-B will fail to enumerate in the
follow sequence.

1.[device-A] send disable slot command
2.[device-B] send enable slot command
3.[device-A] disable slot command completed and wakeup waiting thread
4.[device-B] enable slot command completed with slot_id equal to 1 and
	     wakeup waiting thread
5.[device-B] driver checks that slot_id is still in use (by device-A) in
	     xhci_alloc_virt_device, and fail to enumerate due to this
	     conflict
6.[device-A] xhci->devs[slot_id] set to NULL in xhci_free_virt_device

To fix driver's slot_id resources conflict, clear xhci->devs[slot_id] and
xhci->dcbba->dev_context_ptrs[slot_id] pointers in the interrupt context
when disable slot command completes successfully. Simultaneously, adjust
function xhci_free_virt_device to accurately handle device release.

[minor smatch warning and commit message fix -Mathias]

Cc: stable@vger.kernel.org
Fixes: 7faac1953e ("xhci: avoid race between disable slot command and host runtime suspend")
Signed-off-by: Weitao Wang <WeitaoWang-oc@zhaoxin.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20250819125844.2042452-2-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:24:37 +02:00
arch compiler: remove __ADDRESSABLE_ASM{_STR,}() again 2025-08-28 16:24:37 +02:00
block block: avoid possible overflow for chunk_sectors check in blk_stack_limits() 2025-08-28 16:24:25 +02:00
certs
crypto
Documentation asm-generic: Add memory barrier dma_mb() 2025-08-28 16:24:36 +02:00
drivers usb: xhci: Fix slot_id resource race conflict 2025-08-28 16:24:37 +02:00
fs f2fs: fix to avoid out-of-boundary access in dnode page 2025-08-28 16:24:36 +02:00
include compiler: remove __ADDRESSABLE_ASM{_STR,}() again 2025-08-28 16:24:37 +02:00
init
io_uring
ipc
kernel ftrace: Also allocate and copy hash for reading of filter files 2025-08-28 16:24:34 +02:00
lib
LICENSES
mm mm/debug_vm_pgtable: clear page table entries at destroy_args() 2025-08-28 16:24:34 +02:00
net mptcp: disable add_addr retransmission when timeout is 0 2025-08-28 16:24:35 +02:00
samples
scripts kconfig: lxdialog: fix 'space' to (de)select options 2025-08-28 16:24:25 +02:00
security securityfs: don't pin dentries twice, once is enough... 2025-08-28 16:24:17 +02:00
sound ALSA: hda/realtek: Add support for HP EliteBook x360 830 G6 and EliteBook 830 G6 2025-08-28 16:24:34 +02:00
tools selftests: mptcp: pm: check flush doesn't reset limits 2025-08-28 16:24:37 +02:00
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile kbuild: userprogs: use correct linker when mixing clang and GNU ld 2025-08-28 16:24:33 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.