================================================================== BUG: KASAN: slab-out-of-bounds in blk_mq_free_rqs+0x6e2/0x760 block/blk-mq.c:3488 Read of size 8 at addr ffff888022895d48 by task syz.3.281/6641 CPU: 2 UID: 0 PID: 6641 Comm: syz.3.281 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 blk_mq_free_rqs+0x6e2/0x760 block/blk-mq.c:3488 blk_mq_free_map_and_rqs block/blk-mq.c:4159 [inline] blk_mq_free_map_and_rqs+0x30/0x120 block/blk-mq.c:4154 blk_mq_free_sched_tags+0xeb/0x1b0 block/blk-mq-sched.c:425 blk_mq_free_sched_res+0x52/0x150 block/blk-mq-sched.c:436 elevator_change_done+0x187/0x650 block/elevator.c:639 elevator_change+0x2d7/0x530 block/elevator.c:685 elevator_set_none+0x92/0xf0 block/elevator.c:769 blk_mq_elv_switch_none block/blk-mq.c:5113 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5158 [inline] blk_mq_update_nr_hw_queues+0x4c1/0x15f0 block/blk-mq.c:5223 nbd_start_device+0x1a6/0xbd0 drivers/block/nbd.c:1530 nbd_genl_connect+0xfc2/0x1760 drivers/block/nbd.c:2310 genl_family_rcv_msg_doit+0x214/0x300 net/netlink/genetlink.c:1114 genl_family_rcv_msg net/netlink/genetlink.c:1194 [inline] genl_rcv_msg+0x560/0x800 net/netlink/genetlink.c:1209 netlink_rcv_skb+0x159/0x420 net/netlink/af_netlink.c:2575 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1338 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1364 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1919 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:815 [inline] ____sys_sendmsg+0xa4d/0xbe0 net/socket.c:2713 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2767 __sys_sendmsg+0x160/0x210 net/socket.c:2799 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline] do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f3c1a79e159 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3c1b67d028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f3c1aa25fa0 RCX: 00007f3c1a79e159 RDX: 000000000400400c RSI: 0000200000001ac0 RDI: 000000000000000b RBP: 00007f3c1a83506b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f3c1aa26038 R14: 00007f3c1aa25fa0 R15: 00007ffcbbaaca78 Allocated by task 1: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5414 [inline] __kmalloc_node_noprof+0x342/0x880 mm/slub.c:5426 _kmalloc_array_node_noprof include/linux/slab.h:1297 [inline] blk_mq_alloc_tag_set+0x477/0x1330 block/blk-mq.c:4905 nbd_dev_add+0x341/0xb10 drivers/block/nbd.c:1975 nbd_init+0x2c5/0x2e0 drivers/block/nbd.c:2743 do_one_initcall+0x11c/0x6f0 init/main.c:1362 do_initcall_level init/main.c:1424 [inline] do_initcalls init/main.c:1440 [inline] do_basic_setup init/main.c:1460 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1675 kernel_init+0x21/0x1e0 init/main.c:1565 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888022895d40 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes to the right of allocated 8-byte region [ffff888022895d40, ffff888022895d48) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888022895c20 pfn:0x22895 flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000200 ffff88801c042500 ffffea00016974d0 ffffea0000b5a610 raw: ffff888022895c20 0000000000800079 00000000f5000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2c00(GFP_NOIO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 5432007181 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871 prep_new_page mm/page_alloc.c:1879 [inline] get_page_from_freelist+0x110d/0x35d0 mm/page_alloc.c:3943 __alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436 alloc_slab_page mm/slub.c:3347 [inline] allocate_slab mm/slub.c:3462 [inline] new_slab+0xa9/0x6e0 mm/slub.c:3513 refill_objects+0xe3/0x410 mm/slub.c:7418 refill_sheaf mm/slub.c:2885 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774 alloc_from_pcs mm/slub.c:4850 [inline] slab_alloc_node mm/slub.c:4984 [inline] __do_kmalloc_node mm/slub.c:5413 [inline] __kmalloc_node_track_caller_noprof+0x6a8/0x870 mm/slub.c:5545 __kmemdup_nul mm/util.c:64 [inline] kstrdup+0x51/0xe0 mm/util.c:84 kstrdup_const+0x63/0x80 mm/util.c:104 __kernfs_new_node+0x9b/0xa10 fs/kernfs/dir.c:661 kernfs_new_node fs/kernfs/dir.c:751 [inline] kernfs_create_dir_ns+0xa6/0x2b0 fs/kernfs/dir.c:1120 sysfs_create_dir_ns+0x13a/0x2b0 fs/sysfs/dir.c:59 create_dir lib/kobject.c:73 [inline] kobject_add_internal+0x2c8/0x930 lib/kobject.c:240 kobject_add_varg lib/kobject.c:374 [inline] kobject_add+0x16a/0x1e0 lib/kobject.c:426 blk_mq_register_hctx+0x124/0x460 block/blk-mq-sysfs.c:168 blk_mq_sysfs_register+0x1cc/0x480 block/blk-mq-sysfs.c:235 page_owner free stack trace missing Memory state around the buggy address: ffff888022895c00: fa fc fc fc fa fc fc fc fa fc fc fc 05 fc fc fc ffff888022895c80: 06 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc >ffff888022895d00: 00 fc fc fc 05 fc fc fc 00 fc fc fc 06 fc fc fc ^ ffff888022895d80: 06 fc fc fc 06 fc fc fc 05 fc fc fc 05 fc fc fc ffff888022895e00: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc ==================================================================