aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hidraw.c
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2011-01-28 20:17:30 -0500
committerJiri Kosina <jkosina@suse.cz>2011-02-01 05:16:51 -0500
commit3a22ebe9cc76acac2511b1d3979a35609924ce42 (patch)
treee757b49cfcc9fa3fb5bc0652f1594a12281ce97b /drivers/hid/hidraw.c
parent581548db3b3c0f6e25b500329eb02e3c72e7acbe (diff)
HID: hidraw: fix hidraw_disconnect()
hidraw_disconnect() first sets an entry in hidraw_table to NULL and calls device_destroy() afterwards. The thereby called hidraw_release() tries to read this already cleared value resulting in never removing any device from the list. This got fixed by changing the order of events. Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hidraw.c')
-rw-r--r--drivers/hid/hidraw.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 468e87b53ed2..5516ea45ce80 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -428,12 +428,12 @@ void hidraw_disconnect(struct hid_device *hid)
428 428
429 hidraw->exist = 0; 429 hidraw->exist = 0;
430 430
431 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
432
431 mutex_lock(&minors_lock); 433 mutex_lock(&minors_lock);
432 hidraw_table[hidraw->minor] = NULL; 434 hidraw_table[hidraw->minor] = NULL;
433 mutex_unlock(&minors_lock); 435 mutex_unlock(&minors_lock);
434 436
435 device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
436
437 if (hidraw->open) { 437 if (hidraw->open) {
438 hid_hw_close(hid); 438 hid_hw_close(hid);
439 wake_up_interruptible(&hidraw->wait); 439 wake_up_interruptible(&hidraw->wait);