diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2007-05-22 11:46:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-12 16:29:48 -0700 |
commit | d4ead16f50f9ad30bdc7276ec8fee7a24c72f294 (patch) | |
tree | e1905abbc393cc4d73180dd7b9e1cf860378b590 /drivers/usb/misc/sisusbvga/sisusb_init.h | |
parent | 55e5fdfa541ec7bf1b1613624ed4dd8cdacaa841 (diff) | |
download | kernel_samsung_tuna-d4ead16f50f9ad30bdc7276ec8fee7a24c72f294.zip kernel_samsung_tuna-d4ead16f50f9ad30bdc7276ec8fee7a24c72f294.tar.gz kernel_samsung_tuna-d4ead16f50f9ad30bdc7276ec8fee7a24c72f294.tar.bz2 |
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>
Diffstat (limited to 'drivers/usb/misc/sisusbvga/sisusb_init.h')
-rw-r--r-- | drivers/usb/misc/sisusbvga/sisusb_init.h | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.h b/drivers/usb/misc/sisusbvga/sisusb_init.h index f05f832..864bc0e 100644 --- a/drivers/usb/misc/sisusbvga/sisusb_init.h +++ b/drivers/usb/misc/sisusbvga/sisusb_init.h @@ -808,8 +808,6 @@ static const struct SiS_VCLKData SiSUSB_VCLKData[] = { 0x2b,0xc2, 35} /* 0x71 768@576@60 */ }; -extern struct mutex disconnect_mutex; - int SiSUSBSetMode(struct SiS_Private *SiS_Pr, unsigned short ModeNo); int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo); |