Commit 74388368 authored by Terry Junge's avatar Terry Junge Committed by Greg Kroah-Hartman
Browse files

HID: usbhid: Eliminate recurrent out-of-bounds bug in usbhid_parse()



commit fe7f7ac8 upstream.

Update struct hid_descriptor to better reflect the mandatory and
optional parts of the HID Descriptor as per USB HID 1.11 specification.
Note: the kernel currently does not parse any optional HID class
descriptors, only the mandatory report descriptor.

Update all references to member element desc[0] to rpt_desc.

Add test to verify bLength and bNumDescriptors values are valid.

Replace the for loop with direct access to the mandatory HID class
descriptor member for the report descriptor. This eliminates the
possibility of getting an out-of-bounds fault.

Add a warning message if the HID descriptor contains any unsupported
optional HID class descriptors.

Reported-by: default avatar <syzbot+c52569baf0c843f35495@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=c52569baf0c843f35495


Fixes: f043bfc9 ("HID: usbhid: fix out-of-bounds bug")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTerry Junge <linuxhid@cosmicgizmosystems.com>
Reviewed-by: default avatarMichael Kelley <mhklinux@outlook.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 84e9f0a2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment