A Andrey Konovalov #
Message details and related content
Hi!
I've got the following report while fuzzing the kernel with syzkaller.
On commit 3e0cc09a3a2c40ec1ffb6b4e12da86e98feccb11 (4.14-rc5+).
parse_hid_report_descriptor() has a while (i < length) loop, which
only guarantees that there's at least 1 byte in the buffer, but the
loop body can read multiple bytes which causes out-of-bounds access.
==================================================================
BUG: KASAN: slab-out-of-bounds in parse_hid_report_descriptor+0x1229/0x12a0
Read of size 1 at addr ffff8800674bb2d9 by task kworker/1:2/1038
CPU: 1 PID: 1038 Comm: kworker/1:2 Not tainted 4.14.0-rc5+ #537
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Workqueue: usb_hub_wq hub_event
Call Trace:
__dump_stack lib/dump_stack.c:16
dump_stack+0x192/0x22c lib/dump_stack.c:52
print_address_description+0x73/0x280 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351
kasan_report+0x238/0x350 mm/kasan/report.c:409
__asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427
parse_hid_report_descriptor+0x1229/0x12a0 drivers/input/tablet/gtco.c:242
gtco_probe+0x12b7/0x18d0 drivers/input/tablet/gtco.c:921
usb_probe_interface+0x34c/0x8c0 drivers/usb/core/driver.c:361
really_probe drivers/base/dd.c:413
driver_probe_device+0x60b/0xa00 drivers/base/dd.c:557
__device_attach_driver+0x22b/0x290 drivers/base/dd.c:653
bus_for_each_drv+0x159/0x200 drivers/base/bus.c:463
__device_attach+0x264/0x3c0 drivers/base/dd.c:710
device_initial_probe+0x1a/0x20 drivers/base/dd.c:757
bus_probe_device+0x1d5/0x280 drivers/base/bus.c:523
device_add+0xcf4/0x1630 drivers/base/core.c:1835
usb_set_configuration+0x105f/0x1880 drivers/usb/core/message.c:1932
generic_probe+0x6e/0xe0 drivers/usb/core/generic.c:174
usb_probe_device+0xaa/0xe0 drivers/usb/core/driver.c:266
really_probe drivers/base/dd.c:413
driver_probe_device+0x60b/0xa00 drivers/base/dd.c:557ffff8800674bb280: fc fc fc fc 00 00 00 00 00 00 00 01 fc fc fc fc
^ ffff8800674bb300: 00 00 00 00 00 00 00 00 fc fc fc fc fb fb fb fb ffff8800674bb380: fb fb fb fb fc fc fc fc fb fb fb fb fb fb fb fb ==================================================================