]> git.baikalelectronics.ru Git - kernel.git/commit
usb: core: Don't hold the device lock while sleeping in do_proc_control()
authorTasos Sahanidis <tasos@tasossah.com>
Thu, 31 Mar 2022 21:47:00 +0000 (00:47 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Apr 2022 17:17:00 +0000 (19:17 +0200)
commit360dfe1665d2ced76ddf59b5cee6f3b493f13736
tree2d38acac21461d46b89ba9845659100aef9f7a01
parent34175f971a8c5eb1dd97ef6f042ee8ec916889da
usb: core: Don't hold the device lock while sleeping in do_proc_control()

Since commit 44d03ca1b30a ("USB: core: Make do_proc_control() and
do_proc_bulk() killable") if a device has the USB_QUIRK_DELAY_CTRL_MSG
quirk set, it will temporarily block all other URBs (e.g. interrupts)
while sleeping due to a control.

This results in noticeable delays when, for example, a userspace usbfs
application is sending URB interrupts at a high rate to a keyboard and
simultaneously updates the lock indicators using controls. Interrupts
with direction set to IN are also affected by this, meaning that
delivery of HID reports (containing scancodes) to the usbfs application
is delayed as well.

This patch fixes the regression by calling msleep() while the device
mutex is unlocked, as was the case originally with usb_control_msg().

Fixes: 44d03ca1b30a ("USB: core: Make do_proc_control() and do_proc_bulk() killable")
Cc: stable <stable@kernel.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>
Link: https://lore.kernel.org/r/3e299e2a-13b9-ddff-7fee-6845e868bc06@tasossah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/devio.c