================================================================== BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline] BUG: KASAN: use-after-free in refcount_dec_not_one+0x71/0x1d0 lib/refcount.c:269 Read of size 4 at addr ffff8880ae564dd8 by task systemd-udevd/17742 CPU: 1 PID: 17742 Comm: systemd-udevd Not tainted 4.19.179-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+0x1fc/0x2ef lib/dump_stack.c:118 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354 kasan_report+0x8f/0xa0 mm/kasan/report.c:412 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline] refcount_dec_not_one+0x71/0x1d0 lib/refcount.c:269 refcount_dec_and_mutex_lock+0x1c/0x80 lib/refcount.c:308 nbd_put drivers/block/nbd.c:228 [inline] nbd_release+0x108/0x170 drivers/block/nbd.c:1462 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f6059605270 Code: 73 01 c3 48 8b 0d 38 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c1 20 00 00 75 10 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24 RSP: 002b:00007ffca5869dc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000007 RCX: 00007f6059605270 RDX: 000000000aba9500 RSI: 0000000000000000 RDI: 0000000000000007 RBP: 00007f605a4be710 R08: 0000558173b0d5d0 R09: 0000000000000018 R10: 0000558173b0ba48 R11: 0000000000000246 R12: 0000000000000000 R13: 0000558173af7d50 R14: 0000000000000003 R15: 000000000000000e Allocated by task 17765: kmem_cache_alloc_trace+0x12f/0x380 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] nbd_dev_add+0x44/0x890 drivers/block/nbd.c:1627 nbd_genl_connect+0x4cc/0x1630 drivers/block/nbd.c:1773 genl_family_rcv_msg+0x642/0xc40 net/netlink/genetlink.c:602 genl_rcv_msg+0xbf/0x160 net/netlink/genetlink.c:627 netlink_rcv_skb+0x160/0x440 net/netlink/af_netlink.c:2455 genl_rcv+0x24/0x40 net/netlink/genetlink.c:638 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x4d5/0x690 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x6bb/0xc40 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xc3/0x120 net/socket.c:632 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2115 __sys_sendmsg net/socket.c:2153 [inline] __do_sys_sendmsg net/socket.c:2162 [inline] __se_sys_sendmsg net/socket.c:2160 [inline] __x64_sys_sendmsg+0x132/0x220 net/socket.c:2160 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 17742: __cache_free mm/slab.c:3503 [inline] kfree+0xcc/0x210 mm/slab.c:3822 nbd_dev_remove drivers/block/nbd.c:223 [inline] nbd_put.part.0+0xfe/0x140 drivers/block/nbd.c:231 nbd_put drivers/block/nbd.c:275 [inline] nbd_config_put+0x6a0/0x870 drivers/block/nbd.c:1185 nbd_release+0xf4/0x170 drivers/block/nbd.c:1461 __blkdev_put+0x636/0x870 fs/block_dev.c:1819 blkdev_close+0x86/0xb0 fs/block_dev.c:1888 __fput+0x2ce/0x890 fs/file_table.c:278 task_work_run+0x148/0x1c0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x251/0x2a0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8880ae564d00 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 216 bytes inside of 512-byte region [ffff8880ae564d00, ffff8880ae564f00) The buggy address belongs to the page: page:ffffea0002b95900 count:1 mapcount:0 mapping:ffff88813bff0940 index:0x0 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffffea0002ca45c8 ffffea000275c588 ffff88813bff0940 raw: 0000000000000000 ffff8880ae564080 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880ae564c80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880ae564d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880ae564d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880ae564e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880ae564e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================