WSL2-Linux-Kernel/drivers/usb/class
Pete Zaitcev 9de2c43acf USB: usblp: fix a hang in poll() if disconnected
Apparently an application that opens a device and calls select()
on it, will hang if the decice is disconnected. It's a little
surprising that we had this bug for 15 years, but apparently
nobody ever uses select() with a printer: only write() and read(),
and those work fine. Well, you can also select() with a timeout.

The fix is modeled after devio.c. A few other drivers check the
condition first, then do not add the wait queue in case the
device is disconnected. We doubt that's completely race-free.
So, this patch adds the process first, then locks properly
and checks for the disconnect.

Reviewed-by: Zqiang <qiang.zhang@windriver.com>
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210303221053.1cf3313e@suzdal.zaitcev.lan
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10 09:36:13 +01:00
..
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile USB: add SPDX identifiers to all remaining Makefiles 2017-11-07 15:53:48 +01:00
cdc-acm.c Goodix Fingerprint device is not a modem 2021-03-10 09:36:12 +01:00
cdc-acm.h usb: cdc-acm: fix cooldown mechanism 2020-10-28 13:20:21 +01:00
cdc-wdm.c USB: cdc-wdm: Fix use after free in service_outstanding_interrupt(). 2020-12-28 15:44:23 +01:00
usblp.c USB: usblp: fix a hang in poll() if disconnected 2021-03-10 09:36:13 +01:00
usbtmc.c USB: usbtmc: Bump USBTMC_API_VERSION value 2020-12-28 15:50:30 +01:00