input: syz1 as /devices/virtual/input/input301 input: syz1 as /devices/virtual/input/input302 input: syz1 as /devices/virtual/input/input303 ================================================================== BUG: KASAN: use-after-free in cdev_put.part.0+0x4c/0x50 fs/char_dev.c:373 Read of size 8 at addr ffff88809ac847f0 by task syz-executor250/9272 CPU: 1 PID: 9272 Comm: syz-executor250 Not tainted 4.19.87-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+0x197/0x210 lib/dump_stack.c:118 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396 input: syz1 as /devices/virtual/input/input304 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 cdev_put.part.0+0x4c/0x50 fs/char_dev.c:373 cdev_put fs/char_dev.c:372 [inline] chrdev_open+0x2c1/0x6b0 fs/char_dev.c:431 do_dentry_open+0x4c3/0x1210 fs/open.c:796 vfs_open+0xa0/0xd0 fs/open.c:905 do_last fs/namei.c:3418 [inline] path_openat+0x10d7/0x45e0 fs/namei.c:3534 do_filp_open+0x1a1/0x280 fs/namei.c:3564 do_sys_open+0x3fe/0x550 fs/open.c:1088 __do_sys_open fs/open.c:1106 [inline] __se_sys_open fs/open.c:1101 [inline] __x64_sys_open+0x7e/0xc0 fs/open.c:1101 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x405841 Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 a4 18 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 02 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01 RSP: 002b:00007f3d43f61960 EFLAGS: 00000293 ORIG_RAX: 0000000000000002 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000405841 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00007f3d43f61970 RBP: 6666666666666667 R08: 000000000000000f R09: 00007f3d43f62700 R10: 00007f3d43f629d0 R11: 0000000000000293 R12: 00000000006dbc3c R13: 0000000000000000 R14: 0000000000000000 R15: 00000000317a7973 Allocated by task 9246: save_stack+0x45/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc mm/kasan/kasan.c:553 [inline] kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531 kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] evdev_connect+0x83/0x4d0 drivers/input/evdev.c:1388 input_attach_handler+0x1a0/0x210 drivers/input/input.c:1004 input_register_device.cold+0xda/0x22b drivers/input/input.c:2159 uinput_create_device drivers/input/misc/uinput.c:373 [inline] uinput_ioctl_handler.isra.0+0x1035/0x1c50 drivers/input/misc/uinput.c:878 uinput_ioctl+0x4a/0x60 drivers/input/misc/uinput.c:1049 vfs_ioctl fs/ioctl.c:46 [inline] file_ioctl fs/ioctl.c:501 [inline] do_vfs_ioctl+0xd5f/0x1380 fs/ioctl.c:688 ksys_ioctl+0xab/0xd0 fs/ioctl.c:705 __do_sys_ioctl fs/ioctl.c:712 [inline] __se_sys_ioctl fs/ioctl.c:710 [inline] __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:710 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 9269: save_stack+0x45/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 evdev_free+0x5e/0x70 drivers/input/evdev.c:370 device_release+0x7b/0x210 drivers/base/core.c:892 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put.cold+0x289/0x2e6 lib/kobject.c:708 cdev_default_release+0x41/0x50 fs/char_dev.c:613 kobject_cleanup lib/kobject.c:662 [inline] kobject_release lib/kobject.c:691 [inline] kref_put include/linux/kref.h:70 [inline] kobject_put.cold+0x289/0x2e6 lib/kobject.c:708 cdev_put.part.0+0x39/0x50 fs/char_dev.c:374 cdev_put fs/char_dev.c:372 [inline] chrdev_open+0x2c1/0x6b0 fs/char_dev.c:431 do_dentry_open+0x4c3/0x1210 fs/open.c:796 vfs_open+0xa0/0xd0 fs/open.c:905 do_last fs/namei.c:3418 [inline] path_openat+0x10d7/0x45e0 fs/namei.c:3534 do_filp_open+0x1a1/0x280 fs/namei.c:3564 do_sys_open+0x3fe/0x550 fs/open.c:1088 __do_sys_open fs/open.c:1106 [inline] __se_sys_open fs/open.c:1101 [inline] __x64_sys_open+0x7e/0xc0 fs/open.c:1101 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff88809ac84200 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 1520 bytes inside of 2048-byte region [ffff88809ac84200, ffff88809ac84a00) The buggy address belongs to the page: page:ffffea00026b2100 count:1 mapcount:0 mapping:ffff88812c31cc40 index:0x0 compound_mapcount: 0 flags: 0xfffe0000008100(slab|head) raw: 00fffe0000008100 ffffea00026b1708 ffffea00026b2808 ffff88812c31cc40 raw: 0000000000000000 ffff88809ac84200 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809ac84680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ac84700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88809ac84780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809ac84800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809ac84880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================