original_kernel/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
Kconfig
Makefile
adutux.c
appledisplay.c
auerswald.c
berry_charge.c
cypress_cy7c63.c
cytherm.c
emi26.c
emi26_fw.h
emi62.c
emi62_fw_m.h
emi62_fw_s.h
ftdi-elan.c
idmouse.c
iowarrior.c
ldusb.c
legousbtower.c
phidget.c
phidget.h
phidgetkit.c
phidgetmotorcontrol.c
phidgetservo.c
rio500.c
rio500_usb.h
trancevibrator.c
usb_u132.h
usblcd.c
usbled.c
usbtest.c
uss720.c