====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.1.1635/11140 is trying to acquire lock: ffff8880268740c8 (&q->elevator_lock){+.+.}-{4:4}, at: elevator_change+0x17d/0x580 block/elevator.c:688 but task is already holding lock: ffff888026873b88 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 ( &q->q_usage_counter(io)#49 ){++++}-{0:0}: blk_alloc_queue+0x619/0x760 block/blk-core.c:461 blk_mq_alloc_queue+0x172/0x280 block/blk-mq.c:4400 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4447 nbd_dev_add+0x492/0xbb0 drivers/block/nbd.c:1943 nbd_init+0x181/0x320 drivers/block/nbd.c:2680 do_one_initcall+0x123/0x6e0 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c2/0x910 init/main.c:1579 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x56d/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #5 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4234 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4248 might_alloc include/linux/sched/mm.h:318 [inline] slab_pre_alloc_hook mm/slub.c:4142 [inline] slab_alloc_node mm/slub.c:4220 [inline] __kmalloc_cache_noprof+0x50/0x3e0 mm/slub.c:4402 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] __smc_connect+0x32d/0x4880 net/smc/af_smc.c:1528 smc_connect+0x2fc/0x760 net/smc/af_smc.c:1715 __sys_connect_file+0x141/0x1a0 net/socket.c:2086 __sys_connect+0x13b/0x160 net/socket.c:2105 __do_sys_connect net/socket.c:2111 [inline] __se_sys_connect net/socket.c:2108 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2108 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (sk_lock-AF_SMC){+.+.}-{0:0}: lock_sock_nested+0x41/0xf0 net/core/sock.c:3711 lock_sock include/net/sock.h:1669 [inline] smc_sendmsg+0x47/0x520 net/smc/af_smc.c:2794 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg net/socket.c:729 [inline] sock_sendmsg+0x3cc/0x470 net/socket.c:752 __sock_xmit+0x1e7/0x4f0 drivers/block/nbd.c:574 sock_xmit drivers/block/nbd.c:602 [inline] nbd_send_cmd+0x8e4/0x1c90 drivers/block/nbd.c:712 nbd_handle_cmd drivers/block/nbd.c:1174 [inline] nbd_queue_rq+0x940/0x12d0 drivers/block/nbd.c:1204 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2120 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2358 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2919 blk_mq_flush_plug_list block/blk-mq.c:2967 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2939 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1220 blk_finish_plug block/blk-core.c:1247 [inline] blk_finish_plug block/blk-core.c:1244 [inline] __submit_bio+0x545/0x690 block/blk-core.c:649 __submit_bio_noacct_mq block/blk-core.c:722 [inline] submit_bio_noacct_nocheck+0x660/0xd30 block/blk-core.c:751 submit_bio_noacct+0xc20/0x1ed0 block/blk-core.c:874 submit_bh fs/buffer.c:2829 [inline] __bread_slow fs/buffer.c:1272 [inline] __bread_gfp+0x18c/0x3c0 fs/buffer.c:1518 sb_bread include/linux/buffer_head.h:346 [inline] omfs_fill_super+0x3c8/0x16e0 fs/omfs/inode.c:482 get_tree_bdev_flags+0x38c/0x620 fs/super.c:1692 vfs_get_tree+0x8e/0x340 fs/super.c:1815 do_new_mount fs/namespace.c:3808 [inline] path_mount+0x1513/0x2000 fs/namespace.c:4123 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount fs/namespace.c:4324 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 nbd_handle_cmd drivers/block/nbd.c:1140 [inline] nbd_queue_rq+0x423/0x12d0 drivers/block/nbd.c:1204 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2120 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2358 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2919 blk_mq_flush_plug_list block/blk-mq.c:2967 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2939 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1220 blk_finish_plug block/blk-core.c:1247 [inline] blk_finish_plug block/blk-core.c:1244 [inline] __submit_bio+0x545/0x690 block/blk-core.c:649 __submit_bio_noacct_mq block/blk-core.c:722 [inline] submit_bio_noacct_nocheck+0x660/0xd30 block/blk-core.c:751 submit_bio_noacct+0xc20/0x1ed0 block/blk-core.c:874 submit_bh fs/buffer.c:2829 [inline] __bread_slow fs/buffer.c:1272 [inline] __bread_gfp+0x18c/0x3c0 fs/buffer.c:1518 sb_bread include/linux/buffer_head.h:346 [inline] omfs_fill_super+0x3c8/0x16e0 fs/omfs/inode.c:482 get_tree_bdev_flags+0x38c/0x620 fs/super.c:1692 vfs_get_tree+0x8e/0x340 fs/super.c:1815 do_new_mount fs/namespace.c:3808 [inline] path_mount+0x1513/0x2000 fs/namespace.c:4123 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount fs/namespace.c:4324 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 nbd_queue_rq+0xbd/0x12d0 drivers/block/nbd.c:1196 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2120 __blk_mq_do_dispatch_sched block/blk-mq-sched.c:168 [inline] blk_mq_do_dispatch_sched block/blk-mq-sched.c:182 [inline] __blk_mq_sched_dispatch_requests+0xcb7/0x15f0 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd8/0x1b0 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x239/0x670 block/blk-mq.c:2358 blk_mq_dispatch_list+0x514/0x1310 block/blk-mq.c:2919 blk_mq_flush_plug_list block/blk-mq.c:2967 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2939 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1220 blk_finish_plug block/blk-core.c:1247 [inline] blk_finish_plug block/blk-core.c:1244 [inline] __submit_bio+0x545/0x690 block/blk-core.c:649 __submit_bio_noacct_mq block/blk-core.c:722 [inline] submit_bio_noacct_nocheck+0x660/0xd30 block/blk-core.c:751 submit_bio_noacct+0xc20/0x1ed0 block/blk-core.c:874 submit_bh fs/buffer.c:2829 [inline] __bread_slow fs/buffer.c:1272 [inline] __bread_gfp+0x18c/0x3c0 fs/buffer.c:1518 sb_bread include/linux/buffer_head.h:346 [inline] omfs_fill_super+0x3c8/0x16e0 fs/omfs/inode.c:482 get_tree_bdev_flags+0x38c/0x620 fs/super.c:1692 vfs_get_tree+0x8e/0x340 fs/super.c:1815 do_new_mount fs/namespace.c:3808 [inline] path_mount+0x1513/0x2000 fs/namespace.c:4123 do_mount fs/namespace.c:4136 [inline] __do_sys_mount fs/namespace.c:4347 [inline] __se_sys_mount fs/namespace.c:4324 [inline] __x64_sys_mount+0x28d/0x310 fs/namespace.c:4324 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (set->srcu){.+.+}-{0:0}: srcu_lock_sync include/linux/srcu.h:173 [inline] __synchronize_srcu+0xa1/0x290 kernel/rcu/srcutree.c:1429 blk_mq_wait_quiesce_done block/blk-mq.c:283 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:280 [inline] blk_mq_quiesce_queue block/blk-mq.c:303 [inline] blk_mq_quiesce_queue+0x149/0x1b0 block/blk-mq.c:298 elevator_switch+0x17d/0x810 block/elevator.c:588 elevator_change+0x391/0x580 block/elevator.c:690 elevator_set_default+0x2e9/0x380 block/elevator.c:766 blk_register_queue+0x384/0x4e0 block/blk-sysfs.c:904 __add_disk+0x74a/0xf00 block/genhd.c:528 add_disk_fwnode+0x13f/0x5d0 block/genhd.c:597 add_disk include/linux/blkdev.h:774 [inline] nbd_dev_add+0x783/0xbb0 drivers/block/nbd.c:1973 nbd_init+0x181/0x320 drivers/block/nbd.c:2680 do_one_initcall+0x123/0x6e0 init/main.c:1269 do_initcall_level init/main.c:1331 [inline] do_initcalls init/main.c:1347 [inline] do_basic_setup init/main.c:1366 [inline] kernel_init_freeable+0x5c2/0x910 init/main.c:1579 kernel_init+0x1c/0x2b0 init/main.c:1469 ret_from_fork+0x56d/0x730 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #0 (&q->elevator_lock){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 elevator_change+0x17d/0x580 block/elevator.c:688 elevator_set_none+0xaa/0x120 block/elevator.c:781 blk_mq_elv_switch_none block/blk-mq.c:5023 [inline] __blk_mq_update_nr_hw_queues+0x4bd/0x1200 block/blk-mq.c:5066 blk_mq_update_nr_hw_queues+0x3b/0x60 block/blk-mq.c:5124 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1478 nbd_genl_connect+0x134b/0x1c60 drivers/block/nbd.c:2228 genl_family_rcv_msg_doit+0x209/0x2f0 net/netlink/genetlink.c:1115 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x55c/0x800 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg net/socket.c:729 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2614 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 __sys_sendmsg+0x16d/0x220 net/socket.c:2700 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f other info that might help us debug this: Chain exists of: &q->elevator_lock --> fs_reclaim --> &q->q_usage_counter(io)#49 Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&q->q_usage_counter(io)#49); lock(fs_reclaim); lock(&q->q_usage_counter(io)#49); lock(&q->elevator_lock); *** DEADLOCK *** 6 locks held by syz.1.1635/11140: #0: ffffffff9042c450 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:1218 #1: ffffffff9042c508 (genl_mutex){+.+.}-{4:4}, at: genl_lock net/netlink/genetlink.c:35 [inline] #1: ffffffff9042c508 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:60 [inline] #1: ffffffff9042c508 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:57 [inline] #1: ffffffff9042c508 (genl_mutex){+.+.}-{4:4}, at: genl_rcv_msg+0x577/0x800 net/netlink/genetlink.c:1209 #2: ffff888026961988 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0x27/0x60 block/blk-mq.c:5122 #3: ffff8880269618d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0x31/0x60 block/blk-mq.c:5123 #4: ffff888026873b88 (&q->q_usage_counter(io)#49){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 #5: ffff888026873bc0 (&q->q_usage_counter(queue)#33){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:205 stack backtrace: CPU: 1 UID: 0 PID: 11140 Comm: syz.1.1635 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x350 kernel/locking/lockdep.c:2043 check_noncircular+0x14c/0x170 kernel/locking/lockdep.c:2175 check_prev_add kernel/locking/lockdep.c:3165 [inline] check_prevs_add kernel/locking/lockdep.c:3284 [inline] validate_chain kernel/locking/lockdep.c:3908 [inline] __lock_acquire+0x12a6/0x1ce0 kernel/locking/lockdep.c:5237 lock_acquire kernel/locking/lockdep.c:5868 [inline] lock_acquire+0x179/0x350 kernel/locking/lockdep.c:5825 __mutex_lock_common kernel/locking/mutex.c:598 [inline] __mutex_lock+0x193/0x1060 kernel/locking/mutex.c:760 elevator_change+0x17d/0x580 block/elevator.c:688 elevator_set_none+0xaa/0x120 block/elevator.c:781 blk_mq_elv_switch_none block/blk-mq.c:5023 [inline] __blk_mq_update_nr_hw_queues+0x4bd/0x1200 block/blk-mq.c:5066 blk_mq_update_nr_hw_queues+0x3b/0x60 block/blk-mq.c:5124 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1478 nbd_genl_connect+0x134b/0x1c60 drivers/block/nbd.c:2228 genl_family_rcv_msg_doit+0x209/0x2f0 net/netlink/genetlink.c:1115 genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0x55c/0x800 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x158/0x420 net/netlink/af_netlink.c:2552 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1346 netlink_sendmsg+0x8d1/0xdd0 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:714 [inline] __sock_sendmsg net/socket.c:729 [inline] ____sys_sendmsg+0xa98/0xc70 net/socket.c:2614 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2668 __sys_sendmsg+0x16d/0x220 net/socket.c:2700 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0x4e0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f58cbb8eec9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f58cc99c038 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f58cbde5fa0 RCX: 00007f58cbb8eec9 RDX: 0000000020000000 RSI: 0000200000001ac0 RDI: 0000000000000004 RBP: 00007f58cbc11f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f58cbde6038 R14: 00007f58cbde5fa0 R15: 00007fff66e65958 nbd0: detected capacity change from 0 to 127