]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/2.6.32.12/hid-fix-oops-in-gyration_event.patch
Remove duplicated commits
[thirdparty/kernel/stable-queue.git] / releases / 2.6.32.12 / hid-fix-oops-in-gyration_event.patch
CommitLineData
9659d8ac
GKH
1From d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 Mon Sep 17 00:00:00 2001
2From: Jiri Kosina <jkosina@suse.cz>
3Date: Tue, 23 Mar 2010 16:32:37 +0100
4Subject: HID: fix oops in gyration_event()
5
6From: Jiri Kosina <jkosina@suse.cz>
7
8commit d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 upstream.
9
10Fix oops caused by dereferencing field->hidinput in cases where
11the device hasn't been claimed by hid-input.
12
13Reported-by: Andreas Demmer <mail@andreas-demmer.de>
14Signed-off-by: Jiri Kosina <jkosina@suse.cz>
15Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16
17---
18 drivers/hid/hid-gyration.c | 5 ++++-
19 1 file changed, 4 insertions(+), 1 deletion(-)
20
21--- a/drivers/hid/hid-gyration.c
22+++ b/drivers/hid/hid-gyration.c
23@@ -53,10 +53,13 @@ static int gyration_input_mapping(struct
24 static int gyration_event(struct hid_device *hdev, struct hid_field *field,
25 struct hid_usage *usage, __s32 value)
26 {
27- struct input_dev *input = field->hidinput->input;
28+
29+ if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput)
30+ return 0;
31
32 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK &&
33 (usage->hid & 0xff) == 0x82) {
34+ struct input_dev *input = field->hidinput->input;
35 input_event(input, usage->type, usage->code, 1);
36 input_sync(input);
37 input_event(input, usage->type, usage->code, 0);