linux/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 USB: fix __must_check warnings in drivers/usb/misc/ 2006-09-27 11:58:58 -07:00
emi26_fw.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
emi26.c USB: kmemdup() cleanup in drivers/usb/ 2006-12-01 14:23:27 -08:00
emi62_fw_m.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
emi62_fw_s.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
emi62.c USB: kmemdup() cleanup in drivers/usb/ 2006-12-01 14:23:27 -08:00
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 USB: Put phidgets driver in a sysfs class 2006-09-27 11:58:49 -07:00
phidget.h USB: Put phidgets driver in a sysfs class 2006-09-27 11:58:49 -07:00
phidgetkit.c [PATCH] slab: remove SLAB_ATOMIC 2006-12-07 08:39:24 -08:00
phidgetmotorcontrol.c [PATCH] slab: remove SLAB_ATOMIC 2006-12-07 08:39:24 -08:00
phidgetservo.c USB: Fix oops in PhidgetServo 2006-12-20 10:13:22 -08:00
rio500_usb.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
rio500.c header cleaning: don't include smp_lock.h when not used 2007-05-08 11:15:07 -07:00
trancevibrator.c USB: fix transvibrator disconnect race 2006-12-20 10:13:23 -08:00
usb_u132.h Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6 2006-12-01 16:41:58 -08:00
usblcd.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
usbled.c USB: fix __must_check warnings in drivers/usb/misc/ 2006-09-27 11:58:58 -07:00
usbtest.c [PATCH] slab: remove SLAB_KERNEL 2006-12-07 08:39:24 -08:00
uss720.c potential compiler error, irqfunc caller sites update 2007-07-06 10:23:43 -07:00