aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/usbhid/usbhid.h
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2008-10-27 07:16:15 -0400
committerJiri Kosina <jkosina@suse.cz>2008-10-27 10:06:01 -0400
commit3d5afd324a4bf9f64f59599bf1e93cd7dd1dc97a (patch)
tree920b64f768d33c1534f6bdc37447f8b80494f9fa /drivers/hid/usbhid/usbhid.h
parentf8d56f1771e4867acc461146764b4feeb5245669 (diff)
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>
Diffstat (limited to 'drivers/hid/usbhid/usbhid.h')
-rw-r--r--drivers/hid/usbhid/usbhid.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index abedb13c623e..55973ff54008 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -27,6 +27,7 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/list.h> 29#include <linux/list.h>
30#include <linux/mutex.h>
30#include <linux/timer.h> 31#include <linux/timer.h>
31#include <linux/wait.h> 32#include <linux/wait.h>
32#include <linux/workqueue.h> 33#include <linux/workqueue.h>
@@ -73,6 +74,7 @@ struct usbhid_device {
73 dma_addr_t outbuf_dma; /* Output buffer dma */ 74 dma_addr_t outbuf_dma; /* Output buffer dma */
74 spinlock_t outlock; /* Output fifo spinlock */ 75 spinlock_t outlock; /* Output fifo spinlock */
75 76
77 struct mutex setup;
76 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ 78 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
77 struct timer_list io_retry; /* Retry timer */ 79 struct timer_list io_retry; /* Retry timer */
78 unsigned long stop_retry; /* Time to give up, in jiffies */ 80 unsigned long stop_retry; /* Time to give up, in jiffies */