diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-03-23 16:32:37 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-03-23 16:32:37 +0100 |
commit | d8e4ebf8b603bdcd091540e6b5bddf0dec10d516 (patch) | |
tree | a7d249ce1546ec1bf09f4b8f7fa03871b7ca379e /drivers/hid/hid-gyration.c | |
parent | 39710479303fd3affb3e204e9a7a75cc676977b5 (diff) | |
download | op-kernel-dev-d8e4ebf8b603bdcd091540e6b5bddf0dec10d516.zip op-kernel-dev-d8e4ebf8b603bdcd091540e6b5bddf0dec10d516.tar.gz |
HID: fix oops in gyration_event()
Fix oops caused by dereferencing field->hidinput in cases where
the device hasn't been claimed by hid-input.
Reported-by: Andreas Demmer <mail@andreas-demmer.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-gyration.c')
-rw-r--r-- | drivers/hid/hid-gyration.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/hid/hid-gyration.c b/drivers/hid/hid-gyration.c index cab13e8..62416e6 100644 --- a/drivers/hid/hid-gyration.c +++ b/drivers/hid/hid-gyration.c @@ -53,10 +53,13 @@ static int gyration_input_mapping(struct hid_device *hdev, struct hid_input *hi, static int gyration_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { - struct input_dev *input = field->hidinput->input; + + if (!(hdev->claimed & HID_CLAIMED_INPUT) || !field->hidinput) + return 0; if ((usage->hid & HID_USAGE_PAGE) == HID_UP_GENDESK && (usage->hid & 0xff) == 0x82) { + struct input_dev *input = field->hidinput->input; input_event(input, usage->type, usage->code, 1); input_sync(input); input_event(input, usage->type, usage->code, 0); |