Re: [PATCH] usb: core: hcd: fix possible deadlock in rh control transfers

Alan Stern
2026-04-29T19:04:55Z

On Wed, Apr 29, 2026 at 12:42:06PM +0200, Oliver Neukum wrote:
> From within the SCSI error handler memory allocations must not
> trigger IO. Handling errors in UAS and the storage driver may
> involve resetting a device. The thread doing the reset itself
> relies on VM magic. However, that is insufficient, as resetting
> a device involves resuming it. Resumption as well as resetting
> involves conrol transfers to the parent of the device to be reset.
> That may be a root hub. Hence usbcore must heed the flags passed
> to usb_submit_urb() processing control transfers to root hubs.

The SCSI core prevents devices from suspending while they are in use.
If the error handler wants to do a reset (or if a USB transfer fails and
the driver does a reset to recover), the device won't be in runtime
suspend at the time, and so neither will its root hub.

Besides, even if a resume was necessary, wouldn't the same VM magic that
works for the reset thread also work for the resume? After all, they
will be the same thread; the usb_autoresume_device() call in
usb_reset_device() is synchronous and it is called after
memalloc_noio_save().

Alan Stern