================================================================== BUG: KASAN: slab-out-of-bounds in hiddev_ioctl_usage+0x1764/0x1830 drivers/hid/usbhid/hiddev.c:528 Write of size 4 at addr ffff888187a53e88 by task syz-executor.4/16941 CPU: 0 PID: 16941 Comm: syz-executor.4 Not tainted 5.4.35-syzkaller-00684-g954c82e77d8a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x14a/0x1ce lib/dump_stack.c:118 print_address_description+0x93/0x620 mm/kasan/report.c:374 __kasan_report+0x16d/0x1e0 mm/kasan/report.c:506 kasan_report+0x34/0x60 mm/kasan/common.c:634 hiddev_ioctl_usage+0x1764/0x1830 drivers/hid/usbhid/hiddev.c:528 hiddev_ioctl+0x7a7/0x29a0 drivers/hid/usbhid/hiddev.c:794 do_vfs_ioctl+0x770/0x1750 fs/ioctl.c:47 ksys_ioctl fs/ioctl.c:714 [inline] __do_sys_ioctl fs/ioctl.c:721 [inline] __se_sys_ioctl fs/ioctl.c:719 [inline] __x64_sys_ioctl+0xd4/0x110 fs/ioctl.c:719 do_syscall_64+0xcb/0x150 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x45c829 Code: 0d b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 db b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f7e8caf9c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00000000004e5700 RCX: 000000000045c829 RDX: 0000000020000000 RSI: 000000004018480c RDI: 0000000000000004 RBP: 000000000078bf00 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000000331 R14: 00000000004c596e R15: 00007f7e8cafa6d4 Allocated by task 10190: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc+0x12c/0x1c0 mm/kasan/common.c:510 __kmalloc+0xf7/0x2d0 mm/slub.c:3821 kmalloc include/linux/slab.h:561 [inline] kzalloc+0x1b/0x30 include/linux/slab.h:690 hid_register_field drivers/hid/hid-core.c:102 [inline] hid_add_field+0x69b/0x1740 drivers/hid/hid-core.c:303 hid_parser_main+0x41c/0xd00 drivers/hid/hid-core.c:627 hid_open_report+0x83d/0x1050 drivers/hid/hid-core.c:1253 hid_parse include/linux/hid.h:1017 [inline] appleir_probe+0x104/0x1c0 drivers/hid/hid-appleir.c:302 hid_device_probe+0x274/0x410 drivers/hid/hid-core.c:2263 really_probe+0x6fe/0xf50 drivers/base/dd.c:551 driver_probe_device+0xe6/0x230 drivers/base/dd.c:724 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430 __device_attach+0x275/0x410 drivers/base/dd.c:897 bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490 device_add+0x1054/0x1740 drivers/base/core.c:2507 hid_add_device+0xd7e/0xfd0 drivers/hid/hid-core.c:2419 usbhid_probe+0x94e/0xcc0 drivers/hid/usbhid/hid-core.c:1386 usb_probe_interface+0x621/0xac0 drivers/usb/core/driver.c:361 really_probe+0x75b/0xf50 drivers/base/dd.c:555 driver_probe_device+0xe6/0x230 drivers/base/dd.c:724 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430 __device_attach+0x275/0x410 drivers/base/dd.c:897 bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490 device_add+0x1054/0x1740 drivers/base/core.c:2507 usb_set_configuration+0x184c/0x1dc0 drivers/usb/core/message.c:2023 generic_probe+0x82/0x140 drivers/usb/core/generic.c:210 really_probe+0x75b/0xf50 drivers/base/dd.c:555 driver_probe_device+0xe6/0x230 drivers/base/dd.c:724 bus_for_each_drv+0x17a/0x200 drivers/base/bus.c:430 __device_attach+0x275/0x410 drivers/base/dd.c:897 bus_probe_device+0xb8/0x1e0 drivers/base/bus.c:490 device_add+0x1054/0x1740 drivers/base/core.c:2507 usb_new_device+0xda7/0x1710 drivers/usb/core/hub.c:2548 hub_port_connect drivers/usb/core/hub.c:5110 [inline] hub_port_connect_change drivers/usb/core/hub.c:5225 [inline] port_event drivers/usb/core/hub.c:5371 [inline] hub_event+0x2963/0x4fa0 drivers/usb/core/hub.c:5453 process_one_work+0x777/0xf90 kernel/workqueue.c:2274 process_scheduled_works kernel/workqueue.c:2336 [inline] worker_thread+0xdb6/0x1430 kernel/workqueue.c:2422 kthread+0x2df/0x300 kernel/kthread.c:255 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352 Freed by task 16550: save_stack mm/kasan/common.c:69 [inline] set_track mm/kasan/common.c:77 [inline] kasan_set_free_info mm/kasan/common.c:332 [inline] __kasan_slab_free+0x181/0x230 mm/kasan/common.c:471 slab_free_hook mm/slub.c:1424 [inline] slab_free_freelist_hook+0xd0/0x150 mm/slub.c:1457 slab_free mm/slub.c:3014 [inline] kfree+0x12b/0x600 mm/slub.c:3975 kernfs_fop_release+0x1d5/0x240 fs/kernfs/file.c:782 __fput+0x27d/0x6c0 fs/file_table.c:280 task_work_run+0x176/0x1a0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop arch/x86/entry/common.c:163 [inline] prepare_exit_to_usermode+0x286/0x2e0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff888187a53e00 which belongs to the cache kmalloc-192 of size 192 The buggy address is located 136 bytes inside of 192-byte region [ffff888187a53e00, ffff888187a53ec0) The buggy address belongs to the page: page:ffffea00061e94c0 refcount:1 mapcount:0 mapping:ffff8881da803000 index:0x0 flags: 0x8000000000000200(slab) raw: 8000000000000200 ffffea000748a240 0000000a0000000a ffff8881da803000 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888187a53d80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888187a53e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888187a53e80: 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888187a53f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888187a53f80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================