Skip to contentSkip to conversation

HID: hidraw: fixed hidraw_disconnect()

PATCH Applied Stefan Achatz 2 participants 2 messages Jan 29, 2011 – Feb 1, 2011 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 HID: hidraw: fixed 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.

Maybe commit 0a504541b3ba593535d70f3124546e5e471a175e should be undone if the talkativeness was misdiagnosed due to this error.

---
 drivers/hid/hidraw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/hid/hidraw.c +2 -2
index 468e87b..5516ea4 100644
@@ -428,12 +428,12 @@ void hidraw_disconnect(struct hid_device *hid)
 
 	hidraw->exist = 0;
 
+	device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
+
 	mutex_lock(&minors_lock);
 	hidraw_table[hidraw->minor] = NULL;
 	mutex_unlock(&minors_lock);
 
-	device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
-
 	if (hidraw->open) {
 		hid_hw_close(hid);
 		wake_up_interruptible(&hidraw->wait);
Signature · 1 line
1.7.3.4
Applied
#1 lore raw
Quoted 5 lines · Stefan Achatz

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.

Applied, good catch. Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.