]> git.baikalelectronics.ru Git - kernel.git/commit
HID: logitech: perform bounds checking on device_id early enough
authorJiri Kosina <jkosina@suse.cz>
Thu, 21 Aug 2014 14:57:17 +0000 (09:57 -0500)
committerJiri Kosina <jkosina@suse.cz>
Thu, 21 Aug 2014 15:43:06 +0000 (10:43 -0500)
commitf078b8fa60336a3375f5b7bb2e5c4272d23f7146
tree16cca10139ef4caef5287bf5e7c4618da826d999
parent4ce33ad11e6ed40b2170e25bccba46bfbb980930
HID: logitech: perform bounds checking on device_id early enough

device_index is a char type and the size of paired_dj_deivces is 7
elements, therefore proper bounds checking has to be applied to
device_index before it is used.

We are currently performing the bounds checking in
logi_dj_recv_add_djhid_device(), which is too late, as malicious device
could send REPORT_TYPE_NOTIF_DEVICE_UNPAIRED early enough and trigger the
problem in one of the report forwarding functions called from
logi_dj_raw_event().

Fix this by performing the check at the earliest possible ocasion in
logi_dj_raw_event().

Cc: stable@vger.kernel.org
Reported-by: Ben Hawkes <hawkes@google.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-logitech-dj.c