HID: multitouch: validate indexes details
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 11 Sep 2013 19:56:58 +0000 (21:56 +0200)
committerBadhri Jagan Sridharan <Badhri@google.com>
Fri, 11 Jul 2014 21:24:30 +0000 (14:24 -0700)
commit8d6fa24bc8f6f4441c4bb29f6b7b44393a5c9319
treeaa79188651c202a6f5cdabd5bfb8c608916fea3f
parent9b24c9c51653d4400d9a4aea2dc28124dce2893c
HID: multitouch: validate indexes details

When working on report indexes, always validate that they are in bounds.
Without this, a HID device could report a malicious feature report that
could trick the driver into a heap overflow:

[  634.885003] usb 1-1: New USB device found, idVendor=0596, idProduct=0500
...
[  676.469629] BUG kmalloc-192 (Tainted: G        W   ): Redzone overwritten

Note that we need to change the indexes from s8 to s16 as they can
be between -1 and 255.

CVE-2013-2897

Cc: stable@vger.kernel.org
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-multitouch.c