Thread (3 messages) 3 messages, 2 authors, 2010-08-28

Re: [PATCH] HID: roccat: Fixing race condition on initialization

From: Jiri Slaby <hidden>
Date: 2010-08-28 18:18:22
Also in: lkml

On 08/28/2010 02:57 PM, Stefan Achatz wrote:
quoted hunk ↗ jump to hunk
Fixed raced condition where event occurs before drvdata is set.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
---
 drivers/hid/hid-roccat-kone.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index f776957..cfeab56 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -966,6 +966,10 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report,
 	struct kone_device *kone = hid_get_drvdata(hdev);
 	struct kone_mouse_event *event = (struct kone_mouse_event *)data;
 
+	/* possible race condition on initialization */
+	if (!kone)
+		return 0;
This kind of "protection" caused much headache in the tty layer in the
past. If there is such a problem, please fix the initialization code
instead.

What sort of problems you are seeing?

thanks,
-- 
js
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help