aboutsummaryrefslogtreecommitdiff
path: root/drivers/hid/hid-dummy.c
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2009-02-12 13:17:52 +0100
committerJiri Kosina <jkosina@suse.cz>2009-03-30 15:12:52 +0200
commite43bd67d721bccbfe144c0b586b0ab3a2a157968 (patch)
tree89e8209365c30266166f0155cccc8a80d41922ea /drivers/hid/hid-dummy.c
parent6f4303fb2ec68055e793b84887a7ae0f9ea7cc2d (diff)
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>
Diffstat (limited to 'drivers/hid/hid-dummy.c')
0 files changed, 0 insertions, 0 deletions