HID: fix oops during suspend of unbound HID devices
authorJiri Slaby <jirislaby@gmail.com>
Mon, 27 Oct 2008 11:16:15 +0000 (12:16 +0100)
committerJiri Kosina <jkosina@suse.cz>
Mon, 27 Oct 2008 14:06:01 +0000 (15:06 +0100)
commit3d5afd324a4bf9f64f59599bf1e93cd7dd1dc97a
tree920b64f768d33c1534f6bdc37447f8b80494f9fa
parentf8d56f1771e4867acc461146764b4feeb5245669
HID: fix oops during suspend of unbound HID devices

Usbhid structure is allocated on start invoked only from probe
of some driver. When there is no driver, the structure is null
and causes null-dereference oopses.

Fix it by allocating the structure on probe and disconnect of
the device itself. Also make sure we won't race between start
and resume or stop and suspend respectively.

References: http://bugzilla.kernel.org/show_bug.cgi?id=11827

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Andreas Schwab <schwab@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/usbhid.h
include/linux/hid.h