android_kernel_xiaomi_sm8350/drivers/usb/misc
Alan Stern d4ead16f50 USB: prevent char device open/deregister race
This patch (as908) adds central protection in usbcore for the
prototypical race between opening and unregistering a char device.
The spinlock used to protect the minor-numbers array is replaced with
an rwsem, which can remain locked across a call to a driver's open()
method.  This guarantees that open() and deregister() will be mutually
exclusive.

The private locks currently used in several individual drivers for
this purpose are no longer necessary, and the patch removes them.  The
following USB drivers are affected: usblcd, idmouse, auerswald,
legousbtower, sisusbvga/sisusb, ldusb, adutux, iowarrior, and
usb-skeleton.

As a side effect of this change, usb_deregister_dev() must not be
called while holding a lock that is acquired by open().  Unfortunately
a number of drivers do this, but luckily the solution is simple: call
usb_deregister_dev() before acquiring the lock.

In addition to these changes (and their consequent code
simplifications), the patch fixes a use-after-free bug in adutux and a
race between open() and release() in iowarrior.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-12 16:29:48 -07:00
..
sisusbvga USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
adutux.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
appledisplay.c backlight: Separate backlight properties from backlight ops pointers 2007-02-20 09:26:53 +00:00
auerswald.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
berry_charge.c USB: berry_charge: correct dbg string for second magic command 2007-03-19 13:22:19 -07:00
cypress_cy7c63.c USB: cypress_cy7c63: race disconnect/sysfs read-write leading to following NULL pointer 2007-04-27 13:28:38 -07:00
cytherm.c
emi26_fw.h
emi26.c
emi62_fw_m.h
emi62_fw_s.h
emi62.c
ftdi-elan.c USB: fix more ftdi-elan/u132-hcd #include lossage 2007-05-22 23:45:48 -07:00
idmouse.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
iowarrior.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
Kconfig USB: add driver for iowarrior devices. 2007-02-23 15:03:45 -08:00
ldusb.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
legousbtower.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
Makefile USB: add driver for iowarrior devices. 2007-02-23 15:03:45 -08:00
phidget.c
phidget.h
phidgetkit.c
phidgetmotorcontrol.c
phidgetservo.c
rio500_usb.h
rio500.c header cleaning: don't include smp_lock.h when not used 2007-05-08 11:15:07 -07:00
trancevibrator.c
usb_u132.h
usblcd.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
usbled.c
usbtest.c
uss720.c potential compiler error, irqfunc caller sites update 2007-07-06 10:23:43 -07:00