linux_old1/drivers/hid
Oliver Neukum e43bd67d72 HID: fix race between usb_register_dev() and hiddev_open()
upon further thought this code is still racy.

	retval = usb_register_dev(usbhid->intf, &hiddev_class);

here you open a window during which open can happen

	if (retval) {
		err_hid("Not able to get a minor for this device.");
		hid->hiddev = NULL;
		kfree(hiddev);
		return -1;
	} else {
		hid->minor = usbhid->intf->minor;
		hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;

and will fail because hiddev_table hasn't been updated

The obvious fix of using a mutex to guard hiddev_table doesn't work because
usb_open() and usb_register_dev() take minor_rwsem and we'd have an AB-BA
deadlock. We need a lock usb_open() also takes in the right order and that leaves
only one option, BKL. I don't like it but I see no alternative.

Once the usb_open() implements something better than lock_kernel(), we could also
do so.

Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-03-30 15:12:52 +02:00
..
usbhid HID: fix race between usb_register_dev() and hiddev_open() 2009-03-30 15:12:52 +02:00
Kconfig HID: make HID_DEBUG defaults consistent 2009-03-30 15:12:51 +02:00
Makefile HID: driver for TopSeed Cyberlink quirky remote 2009-01-04 01:00:53 +01:00
hid-a4tech.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-apple.c HID: Apple ALU wireless keyboards are bluetooth devices 2008-11-28 15:09:26 +01:00
hid-belkin.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-cherry.c HID: move cherry quirks 2008-10-14 23:50:52 +02:00
hid-chicony.c HID: move chicony quirks 2008-10-14 23:50:53 +02:00
hid-core.c HID: move tmff and zpff devices from ignore_list to blacklist 2009-02-17 13:25:01 +01:00
hid-cypress.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-debug.c HID: remove CVS keywords 2008-05-20 16:44:43 +02:00
hid-dummy.c HID: force feedback driver for GreenAsia 0x12 PID 2009-01-04 01:00:53 +01:00
hid-ezkey.c HID: move ezkey quirks 2008-10-14 23:50:52 +02:00
hid-gaff.c HID: force feedback driver for GreenAsia 0x12 PID 2009-01-04 01:00:53 +01:00
hid-gyration.c HID: add support for another Gyration remote control 2008-10-17 15:51:35 +02:00
hid-ids.h HID: blacklist Powercom USB UPS 2009-02-17 13:25:01 +01:00
hid-input.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-lg.c HID: automatically call usbhid_set_leds in usbhid driver 2009-01-04 01:00:50 +01:00
hid-lg.h HID: move logitech FF processing 2008-10-14 23:50:56 +02:00
hid-lg2ff.c HID: convert to dev_* prints 2008-10-14 23:51:01 +02:00
hid-lgff.c HID: Autocentering support for Logitech MOMO Racing Wheel 2008-10-14 23:50:58 +02:00
hid-microsoft.c HID: adjust report descriptor fixup for MS 1028 receiver 2009-01-29 11:23:11 +01:00
hid-monterey.c HID: move monterey quirks 2008-10-14 23:50:53 +02:00
hid-ntrig.c HID: add n-trig digitizer support 2009-01-04 01:00:51 +01:00
hid-petalynx.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-pl.c HID: add USB ID for another dual gameron adapter 2008-11-20 15:55:38 +01:00
hid-samsung.c HID: move connect quirks 2008-10-14 23:50:56 +02:00
hid-sony.c HID: fix error condition propagation in hid-sony driver 2009-01-04 01:01:43 +01:00
hid-sunplus.c HID: move sunplus quirks 2008-10-14 23:50:51 +02:00
hid-tmff.c HID: convert to dev_* prints 2008-10-14 23:51:01 +02:00
hid-topseed.c HID: driver for TopSeed Cyberlink quirky remote 2009-01-04 01:00:53 +01:00
hid-zpff.c HID: convert to dev_* prints 2008-10-14 23:51:01 +02:00
hidraw.c HID: unlock properly on error paths in hidraw_ioctl() 2009-02-17 13:25:01 +01:00