================================================================== BUG: KASAN: slab-out-of-bounds in blk_mq_free_rqs+0x6e2/0x760 block/blk-mq.c:3510 Read of size 8 at addr ffff888049155770 by task syz.3.5690/27580 CPU: 1 UID: 0 PID: 27580 Comm: syz.3.5690 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/0x1d0 mm/kasan/report.c:595 blk_mq_free_rqs+0x6e2/0x760 block/blk-mq.c:3510 blk_mq_free_map_and_rqs block/blk-mq.c:4181 [inline] blk_mq_free_map_and_rqs block/blk-mq.c:4176 [inline] blk_mq_prealloc_tag_set_tags block/blk-mq.c:4855 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5182 [inline] blk_mq_update_nr_hw_queues+0xdc5/0x15f0 block/blk-mq.c:5244 nbd_start_device+0x1a6/0xbd0 drivers/block/nbd.c:1489 nbd_genl_connect+0xff2/0x1a40 drivers/block/nbd.c:2239 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:2550 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1894 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf70aef7c Code: d2 74 05 c1 e8 0c 89 02 8b 5d fc 31 c0 c9 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 0f 1f 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 2e 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 58 b8 RSP: 002b:00000000f549d50c EFLAGS: 00000292 ORIG_RAX: 0000000000000172 RAX: ffffffffffffffda RBX: 000000000000000d RCX: 0000000080001ac0 RDX: 0000000000000004 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 27580: 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:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kasan_kmalloc include/linux/kasan.h:263 [inline] __do_kmalloc_node mm/slub.c:5296 [inline] __kmalloc_node_noprof+0x307/0x850 mm/slub.c:5302 kmalloc_array_node_noprof include/linux/slab.h:1169 [inline] blk_mq_alloc_tag_set+0x477/0x1330 block/blk-mq.c:4927 nbd_dev_add+0x342/0xb10 drivers/block/nbd.c:1933 nbd_genl_connect+0xb8d/0x1a40 drivers/block/nbd.c:2125 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:2550 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1894 sock_sendmsg_nosec net/socket.c:787 [inline] __sock_sendmsg net/socket.c:802 [inline] ____sys_sendmsg+0x9e1/0xb70 net/socket.c:2698 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2752 __sys_sendmsg+0x170/0x220 net/socket.c:2784 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe7/0x970 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff888049155760 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 8 bytes to the right of allocated 8-byte region [ffff888049155760, ffff888049155768) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x49155 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000000 ffff88801b842500 dead000000000100 dead000000000122 raw: 0000000000000000 0000000800800080 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 0x1d2cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 25648, tgid 25646 (syz.3.5202), ts 1290999255391, free_ts 1290784920353 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1853 prep_new_page mm/page_alloc.c:1861 [inline] get_page_from_freelist+0x11a6/0x3410 mm/page_alloc.c:3941 __alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5221 alloc_slab_page mm/slub.c:3278 [inline] allocate_slab mm/slub.c:3467 [inline] new_slab+0xa6/0x6c0 mm/slub.c:3525 refill_objects+0x277/0x420 mm/slub.c:7272 refill_sheaf mm/slub.c:2816 [inline] __pcs_replace_empty_main+0x375/0x650 mm/slub.c:4652 alloc_from_pcs mm/slub.c:4750 [inline] slab_alloc_node mm/slub.c:4884 [inline] __do_kmalloc_node mm/slub.c:5295 [inline] __kmalloc_node_track_caller_noprof+0x694/0x850 mm/slub.c:5408 __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/0x9f0 fs/kernfs/dir.c:660 kernfs_new_node+0x11b/0x1a0 fs/kernfs/dir.c:748 __kernfs_create_file+0x53/0x350 fs/kernfs/file.c:1057 sysfs_add_file_mode_ns+0x207/0x3c0 fs/sysfs/file.c:313 create_files fs/sysfs/group.c:82 [inline] internal_create_group+0x593/0xfb0 fs/sysfs/group.c:189 internal_create_groups+0x9d/0x150 fs/sysfs/group.c:229 setup_gid_attrs drivers/infiniband/core/sysfs.c:1118 [inline] ib_setup_port_attrs+0x41f/0x600 drivers/infiniband/core/sysfs.c:1394 page last free pid 45 tgid 45 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] __free_pages_prepare mm/page_alloc.c:1397 [inline] __free_frozen_pages+0x794/0x10a0 mm/page_alloc.c:2938 __folio_put+0x3b4/0x5f0 mm/swap.c:112 folio_put include/linux/mm.h:2090 [inline] migrate_folio_done+0x3a9/0x4c0 mm/migrate.c:1201 migrate_folio_move mm/migrate.c:1432 [inline] migrate_folios_move mm/migrate.c:1740 [inline] migrate_pages_batch+0x27dc/0x45c0 mm/migrate.c:1996 migrate_pages_sync+0x12c/0x880 mm/migrate.c:2026 migrate_pages+0x1aa5/0x2880 mm/migrate.c:2135 compact_zone+0x244f/0x4460 mm/compaction.c:2664 compact_node+0x17f/0x2c0 mm/compaction.c:2933 kcompactd+0x73b/0xdf0 mm/compaction.c:3231 kthread+0x370/0x450 kernel/kthread.c:436 ret_from_fork+0x72b/0xd50 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888049155600: fa fc fc fc fa fc fc fc 04 fc fc fc 02 fc fc fc ffff888049155680: fa fc fc fc fa fc fc fc fa fc fc fc 06 fc fc fc >ffff888049155700: 00 fc fc fc fa fc fc fc fa fc fc fc 00 fc fc fc ^ ffff888049155780: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc ffff888049155800: 05 fc fc fc 05 fc fc fc 05 fc fc fc 05 fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: d2 74 05 c1 shlb %cl,-0x3f(%rbp,%rax,1) 4: e8 0c 89 02 8b call 0x8b028915 9: 5d pop %rbp a: fc cld b: 31 c0 xor %eax,%eax d: c9 leave e: c3 ret f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: 90 nop 1c: 90 nop 1d: 90 nop 1e: 0f 1f 00 nopl (%rax) 21: 51 push %rcx 22: 52 push %rdx 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 ret 2e: 90 nop 2f: 2e 8d b4 26 00 00 00 cs lea 0x0(%rsi,%riz,1),%esi 36: 00 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 3e: 58 pop %rax 3f: b8 .byte 0xb8