linux/drivers/usb/misc/sisusbvga
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
..
Kconfig [PATCH] USB: sisusb[vga] update 2005-09-12 12:23:38 -07:00
Makefile [PATCH] USB: sisusb[vga] update 2005-09-12 12:23:38 -07:00
sisusb.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
sisusb.h [PATCH] USB: convert the semaphores in the sisusb driver to mutexes 2006-06-21 15:04:08 -07:00
sisusb_con.c USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
sisusb_init.c Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
sisusb_init.h USB: prevent char device open/deregister race 2007-07-12 16:29:48 -07:00
sisusb_struct.h [PATCH] USB: sisusbvga: possible cleanups 2006-06-21 15:04:08 -07:00