• Benjamin Tissoires's avatar
    HID: multitouch: validate indexes details · 0b568069
    Benjamin Tissoires authored
    commit 8821f5dc upstream.
    
    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
    Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
    Acked-by: default avatarKees Cook <keescook@chromium.org>
    Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
    [bwh: Backported to 3.2: mt_device::{cc,cc_value,inputmode}_index do not
     exist and the corresponding indices do not need to be validated.
     mt_device::maxcontact_report_id does not exist either.  So all we need
     to do is to widen mt_device::inputmode.]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    0b568069
hid-multitouch.c 24.1 KB