All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HID: hidraw: fixed hidraw_disconnect()
@ 2011-01-29  1:17 Stefan Achatz
  2011-02-01 10:21 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Achatz @ 2011-01-29  1:17 UTC (permalink / raw)
  To: Jiri Kosina, linux-input, linux-kernel

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.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
---
 drivers/hid/hidraw.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 468e87b..5516ea4 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -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);
-- 
1.7.3.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] HID: hidraw: fixed hidraw_disconnect()
  2011-01-29  1:17 [PATCH] HID: hidraw: fixed hidraw_disconnect() Stefan Achatz
@ 2011-02-01 10:21 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2011-02-01 10:21 UTC (permalink / raw)
  To: Stefan Achatz; +Cc: linux-input, linux-kernel

On Sat, 29 Jan 2011, Stefan Achatz wrote:

> 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,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-01 10:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-29  1:17 [PATCH] HID: hidraw: fixed hidraw_disconnect() Stefan Achatz
2011-02-01 10:21 ` Jiri Kosina

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.