linux/drivers
Alan Stern 4a2a8a2cce usbfs: private mutex for open, release, and remove
The usbfs code doesn't provide sufficient mutual exclusion among open,
release, and remove.  Release vs. remove is okay because they both
acquire the device lock, but open is not exclusive with either one.  All
three routines modify the udev->filelist linked list, so they must not
run concurrently.

Apparently someone gave this a minimum amount of thought in the past by
explicitly acquiring the BKL at the start of the usbdev_open routine.
Oddly enough, there's a comment pointing out that locking is unnecessary
because chrdev_open already has acquired the BKL.

But this ignores the point that the files in /proc/bus/usb/* are not
char device files; they are regular files and so they don't get any
special locking.  Furthermore it's necessary to acquire the same lock in
the release and remove routines, which the code does not do.

Yet another problem arises because the same file_operations structure is
accessible through both the /proc/bus/usb/* and /dev/usb/usbdev* file
nodes.  Even when one of them has been removed, it's still possible for
userspace to open the other.  So simple locking around the individual
remove routines is insufficient; we need to lock the entire
usb_notify_remove_device notifier chain.

Rather than rely on the BKL, this patch (as723) introduces a new private
mutex for the purpose.  Holding the BKL while invoking a notifier chain
doesn't seem like a good idea.


Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-27 11:58:49 -07:00
..
acorn i2c-algo-bit: Discard the mdelay data struct member 2006-09-26 15:38:51 -07:00
acpi [PATCH] Really ignore kmem_cache_destroy return value 2006-09-27 08:26:10 -07:00
amba
ata [libata] Fix oops introduced in non-uniform port handling fix 2006-09-25 21:56:33 -04:00
atm [ATM] he: Fix __init/__devinit conflict 2006-09-24 20:09:33 -07:00
base [PATCH] x86 microcode: using request_firmware to pull microcode 2006-09-27 08:26:18 -07:00
block [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
bluetooth [Bluetooth] Enable SCO support for Broadcom HID proxy dongle 2006-07-24 12:44:34 -07:00
cdrom [PATCH] cdrom/gdsc: fix printk format warning 2006-08-27 11:01:33 -07:00
char Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6 2006-09-27 08:49:07 -07:00
clocksource
connector [PATCH] Process Events: Fix biarch compatibility issue. use __u64 timestamp 2006-07-31 13:28:36 -07:00
cpufreq [CPUFREQ] Fix some more CPU hotplug locking. 2006-09-22 19:15:23 -04:00
crypto [CRYPTO] padlock: Convert padlock-sha to use crypto_hash 2006-09-21 11:46:22 +10:00
dio
dma [I/OAT]: Remove pci_module_init() from Intel I/OAT DMA engine 2006-07-21 14:50:13 -07:00
edac [PATCH] drivers/edac/edac_mc.h must #include <linux/platform_device.h> 2006-08-06 08:57:46 -07:00
eisa [PATCH] EISA bus MODALIAS attributes support 2006-09-27 08:26:19 -07:00
fc4 [SCSI] More buffer->request_buffer changes 2006-07-14 09:41:13 -05:00
firmware
hwmon i2c-isa: Restore driver owner 2006-09-26 15:38:52 -07:00
i2c USB: move <linux/usb_otg.h> to <linux/usb/otg.h> 2006-09-27 11:58:48 -07:00
ide Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6 2006-09-26 11:49:46 -07:00
ieee1394 i2c-algo-bit: Discard the mdelay data struct member 2006-09-26 15:38:51 -07:00
infiniband [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
input sh: APM/PM support. 2006-09-27 16:20:22 +09:00
isdn [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
leds [PATCH] net48xx LED cleanups 2006-07-14 21:53:54 -07:00
macintosh [PATCH] asm/backlight.h is ppc-only 2006-09-22 17:48:57 -07:00
mca
md [BLOCK] dm-crypt: trivial comment improvements 2006-09-21 11:46:27 +10:00
media i2c-algo-bit: Discard the mdelay data struct member 2006-09-26 15:38:51 -07:00
message [SCSI] scsi_transport_sas: remove local_attached flag 2006-08-27 22:30:11 -05:00
mfd
misc [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
mmc [PATCH] Alchemy: Delete unused pt_regs * argument from au1xxx_dbdma_chan_alloc 2006-09-26 08:48:54 -07:00
mtd [MTD] Whitespace cleanup in SSFDC driver. 2006-09-23 16:20:48 +01:00
net Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6 2006-09-27 08:49:07 -07:00
nubus
oprofile [PATCH] inode-diet: Eliminate i_blksize from the inode structure 2006-09-27 08:26:18 -07:00
parisc
parport
pci [PATCH] msi: use kmem_cache_zalloc() 2006-09-27 08:26:19 -07:00
pcmcia [PATCH] pcmcia: fix ioctl GET_CONFIGURATION_INFO for pcmcia_cards 2006-07-31 13:28:41 -07:00
pnp [PATCH] pnpacpi: reject ACPI_PRODUCER resources 2006-08-06 08:57:49 -07:00
rapidio
rtc rtc: New RTC driver for SuperH On-Chip RTC. 2006-09-27 17:13:19 +09:00
s390 [SCSI] zfcp: fix: avoid removal of fsf reqs before qdio queues are down 2006-09-23 18:01:46 -05:00
sbus [OPENPROMIO]: Handle current_node being NULL correctly. 2006-09-18 01:47:13 -07:00
scsi [PATCH] EISA bus MODALIAS attributes support 2006-09-27 08:26:19 -07:00
serial serial: Add SERIAL_SH_SCI_NR_UARTS for sh-sci. 2006-09-27 17:32:30 +09:00
sh
sn
spi
tc
telephony
usb usbfs: private mutex for open, release, and remove 2006-09-27 11:58:49 -07:00
video Merge master.kernel.org:/pub/scm/linux/kernel/git/lethal/sh-2.6 2006-09-27 08:49:07 -07:00
w1
zorro
Kconfig Move libata to drivers/ata. 2006-08-10 07:31:37 -04:00
Makefile Move libata to drivers/ata. 2006-08-10 07:31:37 -04:00