summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2011-01-30 13:38:30 +0100
committerJiri Kosina <jkosina@suse.cz>2011-02-03 16:37:28 +0100
commite6fa47af5542df3383a78d7cc78f5d5ef63c0d42 (patch)
tree61ad2667932aeaec1c1572e4f099ba507eb49e33
parentHID: roccat: Fix NULL pointer dereference when unloading module (diff)
downloadlinux-e6fa47af5542df3383a78d7cc78f5d5ef63c0d42.tar.xz
linux-e6fa47af5542df3383a78d7cc78f5d5ef63c0d42.zip
HID: roccat: Fix bug that prevented roccat chardev from removing devices
pointer to device was cleared too early. This is fixed now. Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--drivers/hid/hid-roccat.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c
index 0fa23dead5e1..bbe294c0dd9b 100644
--- a/drivers/hid/hid-roccat.c
+++ b/drivers/hid/hid-roccat.c
@@ -356,13 +356,16 @@ void roccat_disconnect(int minor)
mutex_lock(&devices_lock);
device = devices[minor];
- devices[minor] = NULL;
mutex_unlock(&devices_lock);
device->exist = 0; /* TODO exist maybe not needed */
device_destroy(device->dev->class, MKDEV(roccat_major, minor));
+ mutex_lock(&devices_lock);
+ devices[minor] = NULL;
+ mutex_unlock(&devices_lock);
+
if (device->open) {
hid_hw_close(device->hid);
wake_up_interruptible(&device->wait);