kernel-ark/drivers
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
..
acorn [PATCH] fix request->cmd == INT cases 2007-07-10 08:03:34 +02:00
acpi PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
amba
ata Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
atm PCI: ATM: lanai, change VENDOR to DEVICE 2007-07-11 16:02:10 -07:00
auxdisplay
base sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
block sysfs: kill unnecessary attribute->owner 2007-07-11 16:09:06 -07:00
bluetooth [Bluetooth] Remove the redundant non-seekable llseek method 2007-07-11 06:53:45 +02:00
cdrom Remove legacy CDROM drivers 2007-07-10 08:03:34 +02:00
char Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart 2007-07-12 13:41:54 -07:00
clocksource PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
connector
cpufreq Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq 2007-07-12 13:42:43 -07:00
crypto
dio
dma
edac
eisa
fc4
firewire firewire: fw-sbp2: fix DMA mapping of management ORBs 2007-07-10 00:07:49 +02:00
firmware sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
hid USB: add USB-Persist facility 2007-07-12 16:29:47 -07:00
hwmon
i2c Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
ide Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
ieee1394 ieee1394: remove old isochronous ABI 2007-07-10 00:07:41 +02:00
infiniband Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
input sysfs: kill unnecessary attribute->owner 2007-07-11 16:09:06 -07:00
isdn PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
kvm
leds
macintosh Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-07-12 13:40:20 -07:00
mca
md dm mpath: rdac 2007-07-12 15:01:23 -07:00
media PCI: Change all drivers to use pci_device->revision 2007-07-11 16:02:10 -07:00
message
mfd
misc sysfs: kill unnecessary attribute->owner 2007-07-11 16:09:06 -07:00
mmc Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm 2007-07-12 14:17:12 -07:00
mtd [MIPS] remove LASAT Networks platforms support 2007-07-10 17:33:04 +01:00
net Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
nubus
oprofile
parisc sysfs: kill unnecessary attribute->owner 2007-07-11 16:09:06 -07:00
parport
pci Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6 2007-07-12 13:41:29 -07:00
pcmcia sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
pnp
power [BATTERY] One Laptop Per Child power/battery driver 2007-07-10 11:28:22 +01:00
ps3
rapidio sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
rtc Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2007-07-12 13:40:20 -07:00
s390 sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
sbus
scsi Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
serial Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
sh
sn
spi sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
tc [MIPS] DEC: Fix modpost warning. 2007-07-12 17:41:07 +01:00
telephony
usb USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
video Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/pci-2.6 2007-07-12 13:40:57 -07:00
w1 sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
zorro sysfs: add parameter "struct bin_attribute *" in .read/.write methods for sysfs binary attributes 2007-07-11 16:09:09 -07:00
Kconfig Merge git://git.infradead.org/~dwmw2/battery-2.6 2007-07-10 14:47:59 -07:00
Makefile [BATTERY] Universal power supply class (was: battery class) 2007-07-10 11:25:44 +01:00