All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Achatz <erazor_de@users.sourceforge.net>
To: Jiri Kosina <jkosina@suse.cz>,
	Stefan Achatz <erazor_de@users.sourceforge.net>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Tejun Heo <tj@kernel.org>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] HID: roccat: Fixing race condition on initialization
Date: Sat, 28 Aug 2010 14:57:48 +0200	[thread overview]
Message-ID: <1283000268.4789.1.camel@neuromancer> (raw)

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;
+
 	/* keyboard events are always processed by default handler */
 	if (size != sizeof(struct kone_mouse_event))
 		return 0;
-- 
1.7.2.2




WARNING: multiple messages have this Message-ID (diff)
From: Stefan Achatz <erazor_de@users.sourceforge.net>
To: Jiri Kosina <jkosina@suse.cz>,
	Stefan Achatz <erazor_de@users.sourceforge.net>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Tejun Heo <tj@kernel.org>,
	linux-input@vger.kernel.orglinux
Subject: [PATCH] HID: roccat: Fixing race condition on initialization
Date: Sat, 28 Aug 2010 14:57:48 +0200	[thread overview]
Message-ID: <1283000268.4789.1.camel@neuromancer> (raw)

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;
+
 	/* keyboard events are always processed by default handler */
 	if (size != sizeof(struct kone_mouse_event))
 		return 0;
-- 
1.7.2.2




             reply	other threads:[~2010-08-28 12:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-28 12:57 Stefan Achatz [this message]
2010-08-28 12:57 ` [PATCH] HID: roccat: Fixing race condition on initialization Stefan Achatz
2010-08-28 18:18 ` Jiri Slaby
2010-08-28 22:11   ` Stefan Achatz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1283000268.4789.1.camel@neuromancer \
    --to=erazor_de@users.sourceforge.net \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.