================================================================== BUG: KASAN: use-after-free in strlen+0x79/0x90 lib/string.c:525 Read of size 1 at addr ffff8881c81f2608 by task syz-executor.1/21119 CPU: 0 PID: 21119 Comm: syz-executor.1 Not tainted 5.3.0-rc7+ #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+0xca/0x13e lib/dump_stack.c:113 print_address_description+0x6a/0x32c mm/kasan/report.c:351 __kasan_report.cold+0x1a/0x33 mm/kasan/report.c:482 kasan_report+0xe/0x12 mm/kasan/common.c:618 strlen+0x79/0x90 lib/string.c:525 strlen include/linux/string.h:281 [inline] str_to_user+0x27/0x90 drivers/input/evdev.c:802 evdev_do_ioctl drivers/input/evdev.c:1205 [inline] evdev_ioctl_handler+0x1388/0x19e0 drivers/input/evdev.c:1303 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:509 [inline] do_vfs_ioctl+0xd2d/0x1330 fs/ioctl.c:696 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:713 __do_sys_ioctl fs/ioctl.c:720 [inline] __se_sys_ioctl fs/ioctl.c:718 [inline] __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:718 do_syscall_64+0xb7/0x580 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4598e9 Code: fd 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 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f5a300c1c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000004598e9 RDX: 0000000020000140 RSI: 0000000080404507 RDI: 0000000000000005 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f5a300c26d4 R13: 00000000004c1ae8 R14: 00000000004d4e60 R15: 00000000ffffffff Allocated by task 17347: save_stack+0x1b/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc mm/kasan/common.c:493 [inline] __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:466 kmalloc_array include/linux/slab.h:676 [inline] kcalloc include/linux/slab.h:687 [inline] input_ff_create+0x80/0x309 drivers/input/ff-core.c:330 input_ff_create_memless+0x152/0x467 drivers/input/ff-memless.c:521 xpad_init_ff drivers/input/joystick/xpad.c:1309 [inline] xpad_init_input+0x926/0x1160 drivers/input/joystick/xpad.c:1677 xpad_presence_work+0x5f/0x200 drivers/input/joystick/xpad.c:742 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269 worker_thread+0x96/0xe20 kernel/workqueue.c:2415 kthread+0x318/0x420 kernel/kthread.c:255 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 Freed by task 2780: save_stack+0x1b/0x80 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x130/0x180 mm/kasan/common.c:455 slab_free_hook mm/slub.c:1423 [inline] slab_free_freelist_hook mm/slub.c:1474 [inline] slab_free mm/slub.c:3016 [inline] kfree+0xe4/0x2f0 mm/slub.c:3957 input_ff_destroy+0xe3/0x150 drivers/input/ff-core.c:374 input_dev_release+0x19/0xa0 drivers/input/input.c:1512 device_release+0x71/0x200 drivers/base/core.c:1064 kobject_cleanup lib/kobject.c:693 [inline] kobject_release lib/kobject.c:722 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x171/0x280 lib/kobject.c:739 put_device+0x1b/0x30 drivers/base/core.c:2264 input_put_device include/linux/input.h:346 [inline] input_unregister_device+0xce/0xf0 drivers/input/input.c:2200 xpad_deinit_input drivers/input/joystick/xpad.c:1598 [inline] xpad_deinit_input drivers/input/joystick/xpad.c:1593 [inline] xpad_disconnect+0x368/0x4a3 drivers/input/joystick/xpad.c:1851 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:556 device_del+0x420/0xb10 drivers/base/core.c:2339 usb_disable_device+0x211/0x690 drivers/usb/core/message.c:1237 usb_disconnect+0x284/0x8d0 drivers/usb/core/hub.c:2199 hub_port_connect drivers/usb/core/hub.c:4949 [inline] hub_port_connect_change drivers/usb/core/hub.c:5213 [inline] port_event drivers/usb/core/hub.c:5359 [inline] hub_event+0x1454/0x3640 drivers/usb/core/hub.c:5441 process_one_work+0x92b/0x1530 kernel/workqueue.c:2269 worker_thread+0x96/0xe20 kernel/workqueue.c:2415 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 ffff8881c81f2400 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 520 bytes inside of 1024-byte region [ffff8881c81f2400, ffff8881c81f2800) The buggy address belongs to the page: page:ffffea0007207c00 refcount:1 mapcount:0 mapping:ffff8881da002280 index:0xffff8881c81f2400 compound_mapcount: 0 flags: 0x200000000010200(slab|head) raw: 0200000000010200 ffffea000735cd08 ffffea000768d708 ffff8881da002280 raw: ffff8881c81f2400 00000000000e0005 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c81f2500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c81f2580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881c81f2600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c81f2680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c81f2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================