input: syz0 as /devices/virtual/input/input11 ================================================================== BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:185 [inline] BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline] BUG: KASAN: use-after-free in refcount_dec_not_one+0x9a/0xc0 lib/refcount.c:270 Read of size 4 at addr ffff8882387a2358 by task systemd-udevd/10065 CPU: 1 PID: 10065 Comm: systemd-udevd Not tainted 4.14.302-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x1b2/0x281 lib/dump_stack.c:58 print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252 kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351 kasan_report mm/kasan/report.c:409 [inline] __asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429 __read_once_size include/linux/compiler.h:185 [inline] atomic_read arch/x86/include/asm/atomic.h:27 [inline] refcount_dec_not_one+0x9a/0xc0 lib/refcount.c:270 refcount_dec_and_mutex_lock+0x1a/0x60 lib/refcount.c:309 nbd_put drivers/block/nbd.c:228 [inline] nbd_release+0xf3/0x150 drivers/block/nbd.c:1454 __blkdev_put+0x5aa/0x800 fs/block_dev.c:1803 blkdev_close+0x86/0xb0 fs/block_dev.c:1875 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 RIP: 0033:0x7f2050281270 RSP: 002b:00007ffc35709e78 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007f2050281270 RDX: 000000000aba9500 RSI: 0000000000000000 RDI: 0000000000000007 RBP: 00007f205113b710 R08: 000000000000004a R09: 0000000000000008 R10: 000055962669e1b8 R11: 0000000000000246 R12: 0000000000000000 R13: 000055962668b110 R14: 0000000000000003 R15: 000000000000000e Allocated by task 1: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x131/0x3d0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] nbd_dev_add+0x7c/0x800 drivers/block/nbd.c:1619 nbd_init+0x15b/0x17a drivers/block/nbd.c:2312 do_one_initcall+0x88/0x210 init/main.c:830 do_initcall_level init/main.c:896 [inline] do_initcalls init/main.c:904 [inline] do_basic_setup init/main.c:922 [inline] kernel_init_freeable+0x565/0x626 init/main.c:1081 kernel_init+0xd/0x15d init/main.c:1006 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:406 Freed by task 10065: save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xc9/0x250 mm/slab.c:3815 nbd_dev_remove drivers/block/nbd.c:223 [inline] nbd_put.part.0+0x100/0x140 drivers/block/nbd.c:231 nbd_put drivers/block/nbd.c:267 [inline] nbd_config_put+0x51c/0x6c0 drivers/block/nbd.c:1172 nbd_release+0xdf/0x150 drivers/block/nbd.c:1453 __blkdev_put+0x5aa/0x800 fs/block_dev.c:1803 blkdev_close+0x86/0xb0 fs/block_dev.c:1875 __fput+0x25f/0x7a0 fs/file_table.c:210 task_work_run+0x11f/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x1ad/0x200 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x4a3/0x640 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x5e/0xd3 The buggy address belongs to the object at ffff8882387a2280 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 216 bytes inside of 512-byte region [ffff8882387a2280, ffff8882387a2480) The buggy address belongs to the page: page:ffffea0008e1e880 count:1 mapcount:0 mapping:ffff8882387a2000 index:0x0 flags: 0x57ff00000000100(slab) raw: 057ff00000000100 ffff8882387a2000 0000000000000000 0000000100000006 raw: ffffea0008e1d4e0 ffffea0008e1fb60 ffff88813fe74940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8882387a2200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8882387a2280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8882387a2300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8882387a2380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8882387a2400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================