提交 e5288eb5 编写于 作者: J Jiri Kosina

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: NGuillaume Chazarain <guichaz@gmail.com>
Tested-by: NGuillaume Chazarain <guichaz@gmail.com>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 89092ddd
...@@ -1825,6 +1825,9 @@ int hid_check_keys_pressed(struct hid_device *hid) ...@@ -1825,6 +1825,9 @@ int hid_check_keys_pressed(struct hid_device *hid)
struct hid_input *hidinput; struct hid_input *hidinput;
int i; int i;
if (!(hid->claimed & HID_CLAIMED_INPUT))
return 0;
list_for_each_entry(hidinput, &hid->inputs, list) { list_for_each_entry(hidinput, &hid->inputs, list) {
for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++)
if (hidinput->input->key[i]) if (hidinput->input->key[i])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册