]> git.baikalelectronics.ru Git - kernel.git/commit
xhci: Fix null pointer dereference when host dies
authorMathias Nyman <mathias.nyman@linux.intel.com>
Mon, 16 Jan 2023 14:22:12 +0000 (16:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Jan 2023 06:17:59 +0000 (07:17 +0100)
commit661d796da9b60b3d01dcffa8cb7550b83c965af2
tree44780317bd0eae2de443038c55eab8f8cc209398
parent9255a2665335749eedc77ae8eef3d078017a9ea6
xhci: Fix null pointer dereference when host dies

commit a2bc47c43e70cf904b1af49f76d572326c08bca7 upstream.

Make sure xhci_free_dev() and xhci_kill_endpoint_urbs() do not race
and cause null pointer dereference when host suddenly dies.

Usb core may call xhci_free_dev() which frees the xhci->devs[slot_id]
virt device at the same time that xhci_kill_endpoint_urbs() tries to
loop through all the device's endpoints, checking if there are any
cancelled urbs left to give back.

hold the xhci spinlock while freeing the virt device

Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20230116142216.1141605-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/xhci.c