Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+3
+3
drivers/hid/hid-core.c
··· 1825 1825 struct hid_input *hidinput; 1826 1826 int i; 1827 1827 1828 + if (!(hid->claimed & HID_CLAIMED_INPUT)) 1829 + return 0; 1830 + 1828 1831 list_for_each_entry(hidinput, &hid->inputs, list) { 1829 1832 for (i = 0; i < BITS_TO_LONGS(KEY_MAX); i++) 1830 1833 if (hidinput->input->key[i])