aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2009-05-02 00:02:57 +0200
committerJiri Kosina <jkosina@suse.cz>2009-05-02 00:02:57 +0200
commite5288eb5ea89bd82d897cb687348bc608278f920 (patch)
treebf123fe05a3310667c8f8024f7b459a40cef010e /drivers/hid
parent89092ddd7aca598e3b8874f7a49216e7917d8f3f (diff)
downloadkernel_samsung_smdk4412-e5288eb5ea89bd82d897cb687348bc608278f920.tar.gz
kernel_samsung_smdk4412-e5288eb5ea89bd82d897cb687348bc608278f920.tar.bz2
kernel_samsung_smdk4412-e5288eb5ea89bd82d897cb687348bc608278f920.zip
HID: fix oops in hid_check_keys_pressed()
If the device is not claimed by hid-input (i.e devices driver by userspace hiddev/hidraw-based drivers, or completely detached from HID and driver by libusb), we must not check the hid->inptus, as it is not guaranteed to be initialized, as this is performed only for devices handled by hid-input. Reported-by: Guillaume Chazarain <guichaz@gmail.com> Tested-by: Guillaume Chazarain <guichaz@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r--drivers/hid/hid-core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c7075d2b078..8551693d645 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1825,6 +1825,9 @@ int hid_check_keys_pressed(struct hid_device *hid)
struct hid_input *hidinput;
int i;
+ if (!(hid->claimed & HID_CLAIMED_INPUT))
+ return 0;
+
list_for_each_entry(hidinput, &hid->inputs, list) {
for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++)
if (hidinput->input->key[i])