raw: raw_ioctl_run: fail, usb_gadget_probe_driver returned -16 ================================================================== BUG: KASAN: slab-out-of-bounds in clear_bit include/asm-generic/bitops-instrumented.h:56 [inline] BUG: KASAN: slab-out-of-bounds in hidinput_setkeycode+0x16e/0x390 drivers/hid/hid-input.c:165 Write of size 8 at addr ffff8881d54c39e8 by task syz-executor.4/5390 CPU: 1 PID: 5390 Comm: syz-executor.4 Not tainted 5.4.0-syzkaller #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+0xef/0x16e lib/dump_stack.c:118 print_address_description.constprop.0+0x36/0x50 mm/kasan/report.c:374 __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:506 kasan_report+0xe/0x20 mm/kasan/common.c:638 check_memory_region_inline mm/kasan/generic.c:185 [inline] check_memory_region+0x128/0x190 mm/kasan/generic.c:192 clear_bit include/asm-generic/bitops-instrumented.h:56 [inline] hidinput_setkeycode+0x16e/0x390 drivers/hid/hid-input.c:165 input_set_keycode+0x104/0x320 drivers/input/input.c:935 evdev_handle_set_keycode_v2+0xc4/0x120 drivers/input/evdev.c:882 evdev_do_ioctl drivers/input/evdev.c:1150 [inline] evdev_ioctl_handler+0xd49/0x19f0 drivers/input/evdev.c:1284 vfs_ioctl fs/ioctl.c:47 [inline] file_ioctl fs/ioctl.c:539 [inline] do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:726 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:743 __do_sys_ioctl fs/ioctl.c:750 [inline] __se_sys_ioctl fs/ioctl.c:748 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:748 do_syscall_64+0xb7/0x5b0 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45a6f9 Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f6b895cac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000045a6f9 RDX: 0000000020000080 RSI: 0000000040284504 RDI: 0000000000000008 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6b895cb6d4 R13: 00000000004c2d5f R14: 00000000004d7f70 R15: 00000000ffffffff Allocated by task 12: save_stack+0x1b/0x80 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] __kasan_kmalloc mm/kasan/common.c:512 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:485 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:670 [inline] input_allocate_device+0x3e/0x260 drivers/input/input.c:1810 hidinput_allocate drivers/hid/hid-input.c:1654 [inline] hidinput_connect+0x3cab/0xdb90 drivers/hid/hid-input.c:1899 hid_connect+0x965/0xbb0 drivers/hid/hid-core.c:1923 hid_hw_start drivers/hid/hid-core.c:2027 [inline] hid_hw_start+0xa2/0x130 drivers/hid/hid-core.c:2018 ms_probe+0x159/0x4d0 drivers/hid/hid-microsoft.c:394 hid_device_probe+0x2be/0x3f0 drivers/hid/hid-core.c:2255 really_probe+0x281/0x6d0 drivers/base/dd.c:548 driver_probe_device+0x104/0x210 drivers/base/dd.c:721 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430 __device_attach+0x217/0x360 drivers/base/dd.c:894 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490 device_add+0x1480/0x1c20 drivers/base/core.c:2487 hid_add_device drivers/hid/hid-core.c:2411 [inline] hid_add_device+0x33c/0x9a0 drivers/hid/hid-core.c:2360 usbhid_probe+0xa81/0xfa0 drivers/hid/usbhid/hid-core.c:1386 usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361 really_probe+0x281/0x6d0 drivers/base/dd.c:548 driver_probe_device+0x104/0x210 drivers/base/dd.c:721 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430 __device_attach+0x217/0x360 drivers/base/dd.c:894 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490 device_add+0x1480/0x1c20 drivers/base/core.c:2487 usb_set_configuration+0xe67/0x1740 drivers/usb/core/message.c:2023 generic_probe+0x9d/0xd5 drivers/usb/core/generic.c:210 usb_probe_device+0x99/0x100 drivers/usb/core/driver.c:266 really_probe+0x281/0x6d0 drivers/base/dd.c:548 driver_probe_device+0x104/0x210 drivers/base/dd.c:721 __device_attach_driver+0x1c2/0x220 drivers/base/dd.c:828 bus_for_each_drv+0x162/0x1e0 drivers/base/bus.c:430 __device_attach+0x217/0x360 drivers/base/dd.c:894 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:490 device_add+0x1480/0x1c20 drivers/base/core.c:2487 usb_new_device.cold+0x6a4/0xe79 drivers/usb/core/hub.c:2537 hub_port_connect drivers/usb/core/hub.c:5184 [inline] hub_port_connect_change drivers/usb/core/hub.c:5324 [inline] port_event drivers/usb/core/hub.c:5470 [inline] hub_event+0x1e59/0x3860 drivers/usb/core/hub.c:5552 process_one_work+0x92b/0x1530 kernel/workqueue.c:2264 process_scheduled_works kernel/workqueue.c:2326 [inline] worker_thread+0x7ab/0xe20 kernel/workqueue.c:2412 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Freed by task 22: save_stack+0x1b/0x80 mm/kasan/common.c:71 set_track mm/kasan/common.c:79 [inline] kasan_set_free_info mm/kasan/common.c:334 [inline] __kasan_slab_free+0x130/0x180 mm/kasan/common.c:473 slab_free_hook mm/slub.c:1425 [inline] slab_free_freelist_hook mm/slub.c:1458 [inline] slab_free mm/slub.c:3005 [inline] kfree+0xdc/0x310 mm/slub.c:3957 device_release+0x71/0x200 drivers/base/core.c:1358 kobject_cleanup lib/kobject.c:693 [inline] kobject_release lib/kobject.c:722 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1e7/0x2e0 lib/kobject.c:739 put_device drivers/base/core.c:2586 [inline] device_unregister drivers/base/core.c:2697 [inline] device_destroy+0x9e/0xe0 drivers/base/core.c:3275 usb_deregister_dev+0x89/0x290 drivers/usb/core/file.c:237 hiddev_disconnect+0x91/0x1b4 drivers/hid/usbhid/hiddev.c:942 hid_disconnect+0xb4/0x1a0 drivers/hid/hid-core.c:2002 hid_hw_stop+0x12/0x70 drivers/hid/hid-core.c:2047 cmhid_remove+0x38/0x50 drivers/hid/hid-cmedia.c:140 hid_device_remove+0xed/0x240 drivers/hid/hid-core.c:2288 __device_release_driver drivers/base/dd.c:1132 [inline] device_release_driver_internal+0x231/0x500 drivers/base/dd.c:1165 bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:532 device_del+0x481/0xd30 drivers/base/core.c:2664 hid_remove_device drivers/hid/hid-core.c:2459 [inline] hid_destroy_device+0xe1/0x150 drivers/hid/hid-core.c:2478 usbhid_disconnect+0x9f/0xe0 drivers/hid/usbhid/hid-core.c:1413 usb_unbind_interface+0x1bd/0x8a0 drivers/usb/core/driver.c:423 __device_release_driver drivers/base/dd.c:1134 [inline] device_release_driver_internal+0x42f/0x500 drivers/base/dd.c:1165 bus_remove_device+0x2dc/0x4a0 drivers/base/bus.c:532 device_del+0x481/0xd30 drivers/base/core.c:2664 usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237 usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2200 hub_port_connect drivers/usb/core/hub.c:5035 [inline] hub_port_connect_change drivers/usb/core/hub.c:5324 [inline] port_event drivers/usb/core/hub.c:5470 [inline] hub_event+0x1753/0x3860 drivers/usb/core/hub.c:5552 process_one_work+0x92b/0x1530 kernel/workqueue.c:2264 worker_thread+0x96/0xe20 kernel/workqueue.c:2410 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 The buggy address belongs to the object at ffff8881d54c3000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 488 bytes to the right of 2048-byte region [ffff8881d54c3000, ffff8881d54c3800) The buggy address belongs to the page: page:ffffea0007553000 refcount:1 mapcount:0 mapping:ffff8881da40c000 index:0x0 compound_mapcount: 0 raw: 0200000000010200 0000000000000000 0000000100000001 ffff8881da40c000 raw: 0000000000000000 0000000080080008 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881d54c3880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881d54c3900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881d54c3980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8881d54c3a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881d54c3a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================