nbd: socks must be embedded in a SOCK_ITEM attr nbd: socks must be embedded in a SOCK_ITEM attr nbd: socks must be embedded in a SOCK_ITEM attr nbd: socks must be embedded in a SOCK_ITEM attr ================================================================== BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:183 [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 ffff88809edea358 by task syz-executor506/8029 CPU: 0 PID: 8029 Comm: syz-executor506 Not tainted 4.14.244-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 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:183 [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_genl_connect+0xf94/0x1400 drivers/block/nbd.c:1896 genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2435 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636 netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline] netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1315 netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1880 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:656 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062 __sys_sendmsg+0xa3/0x120 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x27/0x40 net/socket.c:2103 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x440669 RSP: 002b:00007fff26aa1c88 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00000000000069b1 RCX: 0000000000440669 RDX: 0000000000000000 RSI: 0000000020000b40 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000000 R09: 00007fff26aa1e28 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff26aa1c9c R13: 431bde82d7b634db R14: 00000000004ae018 R15: 00000000004004a0 Allocated by task 8024: 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:1611 nbd_genl_connect+0x36c/0x1400 drivers/block/nbd.c:1767 genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2435 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636 netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline] netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1315 netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1880 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:656 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062 __sys_sendmsg+0xa3/0x120 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x27/0x40 net/socket.c:2103 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 8029: 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+0x62a/0x810 drivers/block/nbd.c:1172 nbd_genl_connect+0xf6c/0x1400 drivers/block/nbd.c:1894 genl_family_rcv_msg+0x572/0xb20 net/netlink/genetlink.c:600 genl_rcv_msg+0xaf/0x140 net/netlink/genetlink.c:625 netlink_rcv_skb+0x125/0x390 net/netlink/af_netlink.c:2435 genl_rcv+0x24/0x40 net/netlink/genetlink.c:636 netlink_unicast_kernel net/netlink/af_netlink.c:1289 [inline] netlink_unicast+0x437/0x610 net/netlink/af_netlink.c:1315 netlink_sendmsg+0x62e/0xb80 net/netlink/af_netlink.c:1880 sock_sendmsg_nosec net/socket.c:646 [inline] sock_sendmsg+0xb5/0x100 net/socket.c:656 ___sys_sendmsg+0x6c8/0x800 net/socket.c:2062 __sys_sendmsg+0xa3/0x120 net/socket.c:2096 SYSC_sendmsg net/socket.c:2107 [inline] SyS_sendmsg+0x27/0x40 net/socket.c:2103 do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb The buggy address belongs to the object at ffff88809edea280 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 216 bytes inside of 512-byte region [ffff88809edea280, ffff88809edea480) The buggy address belongs to the page: page:ffffea00027b7a80 count:1 mapcount:0 mapping:ffff88809edea000 index:0xffff88809edea780 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffff88809edea000 ffff88809edea780 0000000100000004 raw: ffffea0002809c60 ffffea00027f9c20 ffff88813fe80940 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809edea200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88809edea280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88809edea300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809edea380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809edea400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================