====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ syz.2.2074/17459 is trying to acquire lock: ffff8880416fbb18 (set->srcu){.+.+}-{0:0}, at: srcu_lock_sync include/linux/srcu.h:197 [inline] ffff8880416fbb18 (set->srcu){.+.+}-{0:0}, at: __synchronize_srcu+0x1c/0x250 kernel/rcu/srcutree.c:1503 but task is already holding lock: ffff888041fab548 (&q->elevator_lock){+.+.}-{4:4}, at: elevator_change+0x1ed/0x570 block/elevator.c:678 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (&q->elevator_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x1aa/0x1ca0 kernel/locking/mutex.c:776 elevator_change+0x1ed/0x570 block/elevator.c:678 elevator_set_none+0x8e/0x100 block/elevator.c:768 blk_mq_elv_switch_none block/blk-mq.c:5084 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5128 [inline] blk_mq_update_nr_hw_queues+0x4d5/0x1280 block/blk-mq.c:5186 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1489 nbd_start_device_ioctl drivers/block/nbd.c:1548 [inline] __nbd_ioctl drivers/block/nbd.c:1623 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1663 compat_blkdev_ioctl+0x2ee/0x7a0 block/ioctl.c:848 __do_compat_sys_ioctl fs/ioctl.c:695 [inline] __se_compat_sys_ioctl fs/ioctl.c:638 [inline] __ia32_compat_sys_ioctl+0x242/0x370 fs/ioctl.c:638 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe8/0x680 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #5 (&q->q_usage_counter(io)#51){++++}-{0:0}: blk_alloc_queue+0x610/0x750 block/blk-core.c:461 blk_mq_alloc_queue+0x172/0x280 block/blk-mq.c:4415 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4462 nbd_dev_add+0x492/0xbb0 drivers/block/nbd.c:1954 nbd_init+0x181/0x320 drivers/block/nbd.c:2692 do_one_initcall+0x123/0x680 init/main.c:1378 do_initcall_level init/main.c:1440 [inline] do_initcalls init/main.c:1456 [inline] do_basic_setup init/main.c:1475 [inline] kernel_init_freeable+0x5c8/0x920 init/main.c:1688 kernel_init+0x1c/0x2b0 init/main.c:1578 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 -> #4 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4301 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:4315 might_alloc include/linux/sched/mm.h:317 [inline] slab_pre_alloc_hook mm/slub.c:4904 [inline] slab_alloc_node mm/slub.c:5239 [inline] __kmalloc_cache_node_noprof+0x5b/0x830 mm/slub.c:5784 kmalloc_node_noprof include/linux/slab.h:983 [inline] alloc_worker kernel/workqueue.c:2641 [inline] create_worker+0x10f/0x7e0 kernel/workqueue.c:2784 workqueue_prepare_cpu+0xb5/0x160 kernel/workqueue.c:6674 cpuhp_invoke_callback+0x3d5/0xa10 kernel/cpu.c:195 __cpuhp_invoke_callback_range+0x101/0x210 kernel/cpu.c:968 cpuhp_invoke_callback_range kernel/cpu.c:992 [inline] cpuhp_up_callbacks kernel/cpu.c:1023 [inline] _cpu_up+0x3f5/0x960 kernel/cpu.c:1685 cpu_up+0x1bf/0x240 kernel/cpu.c:1717 cpuhp_bringup_mask+0xd8/0x210 kernel/cpu.c:1783 cpuhp_bringup_cpus_parallel kernel/cpu.c:1861 [inline] bringup_nonboot_cpus+0xf5/0x1c0 kernel/cpu.c:1887 smp_init+0x34/0x160 kernel/smp.c:1001 kernel_init_freeable+0x3ab/0x920 init/main.c:1680 kernel_init+0x1c/0x2b0 init/main.c:1578 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 -> #3 (cpu_hotplug_lock){++++}-{0:0}: percpu_down_read_internal include/linux/percpu-rwsem.h:53 [inline] percpu_down_read include/linux/percpu-rwsem.h:77 [inline] cpus_read_lock+0x42/0x160 kernel/cpu.c:491 static_key_slow_inc+0x12/0x30 kernel/jump_label.c:190 nbd_reconnect_socket drivers/block/nbd.c:1342 [inline] nbd_genl_reconfigure+0xd9c/0x1ca0 drivers/block/nbd.c:2431 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:2550 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x5aa/0x870 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x8c8/0xdd0 net/netlink/af_netlink.c:1894 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg net/socket.c:742 [inline] ____sys_sendmsg+0xa5d/0xc30 net/socket.c:2592 ___sys_sendmsg+0x134/0x1d0 net/socket.c:2646 __sys_sendmsg+0x16d/0x220 net/socket.c:2678 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe8/0x680 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e -> #2 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x1aa/0x1ca0 kernel/locking/mutex.c:776 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x423/0x12d0 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2138 __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+0xcbd/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:2376 blk_mq_dispatch_list+0x514/0x1300 block/blk-mq.c:2939 blk_mq_flush_plug_list block/blk-mq.c:2987 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2959 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] blk_finish_plug block/blk-core.c:1249 [inline] __submit_bio+0x542/0x690 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x53d/0xbe0 block/blk-core.c:755 submit_bio_noacct+0x5bd/0x1f40 block/blk-core.c:879 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x34e/0x850 fs/buffer.c:2447 filemap_read_folio+0xc8/0x2a0 mm/filemap.c:2496 do_read_cache_folio+0x266/0x5c0 mm/filemap.c:4096 read_mapping_folio include/linux/pagemap.h:1017 [inline] read_part_sector+0xd4/0x370 block/partitions/core.c:722 adfspart_check_ICS+0x93/0x940 block/partitions/acorn.c:360 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x723/0x1520 block/partitions/core.c:693 blkdev_get_whole+0x187/0x290 block/bdev.c:765 bdev_open+0x2c7/0xe40 block/bdev.c:974 blkdev_open+0x34e/0x4f0 block/fops.c:698 do_dentry_open+0x748/0x1590 fs/open.c:962 vfs_open+0x82/0x3f0 fs/open.c:1094 do_open fs/namei.c:4628 [inline] path_openat+0x2078/0x3140 fs/namei.c:4787 do_filp_open+0x20b/0x470 fs/namei.c:4814 do_sys_openat2+0x121/0x290 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #1 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:614 [inline] __mutex_lock+0x1aa/0x1ca0 kernel/locking/mutex.c:776 nbd_queue_rq+0xbd/0x12d0 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x416/0x1e20 block/blk-mq.c:2138 __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+0xcbd/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:2376 blk_mq_dispatch_list+0x514/0x1300 block/blk-mq.c:2939 blk_mq_flush_plug_list block/blk-mq.c:2987 [inline] blk_mq_flush_plug_list+0x130/0x600 block/blk-mq.c:2959 __blk_flush_plug+0x2c4/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] blk_finish_plug block/blk-core.c:1249 [inline] __submit_bio+0x542/0x690 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x53d/0xbe0 block/blk-core.c:755 submit_bio_noacct+0x5bd/0x1f40 block/blk-core.c:879 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x34e/0x850 fs/buffer.c:2447 filemap_read_folio+0xc8/0x2a0 mm/filemap.c:2496 do_read_cache_folio+0x266/0x5c0 mm/filemap.c:4096 read_mapping_folio include/linux/pagemap.h:1017 [inline] read_part_sector+0xd4/0x370 block/partitions/core.c:722 adfspart_check_ICS+0x93/0x940 block/partitions/acorn.c:360 check_partition block/partitions/core.c:141 [inline] blk_add_partitions block/partitions/core.c:589 [inline] bdev_disk_changed+0x723/0x1520 block/partitions/core.c:693 blkdev_get_whole+0x187/0x290 block/bdev.c:765 bdev_open+0x2c7/0xe40 block/bdev.c:974 blkdev_open+0x34e/0x4f0 block/fops.c:698 do_dentry_open+0x748/0x1590 fs/open.c:962 vfs_open+0x82/0x3f0 fs/open.c:1094 do_open fs/namei.c:4628 [inline] path_openat+0x2078/0x3140 fs/namei.c:4787 do_filp_open+0x20b/0x470 fs/namei.c:4814 do_sys_openat2+0x121/0x290 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_sys_openat fs/open.c:1452 [inline] __se_sys_openat fs/open.c:1447 [inline] __x64_sys_openat+0x174/0x210 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (set->srcu){.+.+}-{0:0}: 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+0x1669/0x2890 kernel/locking/lockdep.c:5237 lock_sync+0xa0/0x110 kernel/locking/lockdep.c:5916 srcu_lock_sync include/linux/srcu.h:197 [inline] __synchronize_srcu+0xa2/0x250 kernel/rcu/srcutree.c:1503 blk_mq_wait_quiesce_done block/blk-mq.c:284 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:281 [inline] blk_mq_quiesce_queue block/blk-mq.c:304 [inline] blk_mq_quiesce_queue+0x149/0x1b0 block/blk-mq.c:299 elevator_switch+0x355/0x7f0 block/elevator.c:576 elevator_change+0x38b/0x570 block/elevator.c:680 elevator_set_none+0x8e/0x100 block/elevator.c:768 blk_mq_elv_switch_none block/blk-mq.c:5084 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5128 [inline] blk_mq_update_nr_hw_queues+0x4d5/0x1280 block/blk-mq.c:5186 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1489 nbd_start_device_ioctl drivers/block/nbd.c:1548 [inline] __nbd_ioctl drivers/block/nbd.c:1623 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1663 compat_blkdev_ioctl+0x2ee/0x7a0 block/ioctl.c:848 __do_compat_sys_ioctl fs/ioctl.c:695 [inline] __se_compat_sys_ioctl fs/ioctl.c:638 [inline] __ia32_compat_sys_ioctl+0x242/0x370 fs/ioctl.c:638 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe8/0x680 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Chain exists of: set->srcu --> &q->q_usage_counter(io)#51 --> &q->elevator_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&q->elevator_lock); lock(&q->q_usage_counter(io)#51); lock(&q->elevator_lock); sync(set->srcu); *** DEADLOCK *** 5 locks held by syz.2.2074/17459: #0: ffff88802629b1d0 (&set->update_nr_hwq_lock){++++}-{4:4}, at: blk_mq_update_nr_hw_queues+0x91/0x1280 block/blk-mq.c:5184 #1: ffff88802629b0d8 (&set->tag_list_lock){+.+.}-{4:4}, at: blk_mq_update_nr_hw_queues+0xa4/0x1280 block/blk-mq.c:5185 #2: ffff888041fab008 (&q->q_usage_counter(io)#51){++++}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:206 #3: ffff888041fab040 (&q->q_usage_counter(queue)#35){+.+.}-{0:0}, at: blk_mq_freeze_queue_nomemsave+0x15/0x20 block/blk-mq.c:206 #4: ffff888041fab548 (&q->elevator_lock){+.+.}-{4:4}, at: elevator_change+0x1ed/0x570 block/elevator.c:678 stack backtrace: CPU: 3 UID: 0 PID: 17459 Comm: syz.2.2074 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~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x275/0x340 kernel/locking/lockdep.c:2043 check_noncircular+0x146/0x160 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+0x1669/0x2890 kernel/locking/lockdep.c:5237 lock_sync+0xa0/0x110 kernel/locking/lockdep.c:5916 srcu_lock_sync include/linux/srcu.h:197 [inline] __synchronize_srcu+0xa2/0x250 kernel/rcu/srcutree.c:1503 blk_mq_wait_quiesce_done block/blk-mq.c:284 [inline] blk_mq_wait_quiesce_done block/blk-mq.c:281 [inline] blk_mq_quiesce_queue block/blk-mq.c:304 [inline] blk_mq_quiesce_queue+0x149/0x1b0 block/blk-mq.c:299 elevator_switch+0x355/0x7f0 block/elevator.c:576 elevator_change+0x38b/0x570 block/elevator.c:680 elevator_set_none+0x8e/0x100 block/elevator.c:768 blk_mq_elv_switch_none block/blk-mq.c:5084 [inline] __blk_mq_update_nr_hw_queues block/blk-mq.c:5128 [inline] blk_mq_update_nr_hw_queues+0x4d5/0x1280 block/blk-mq.c:5186 nbd_start_device+0x1b0/0xd70 drivers/block/nbd.c:1489 nbd_start_device_ioctl drivers/block/nbd.c:1548 [inline] __nbd_ioctl drivers/block/nbd.c:1623 [inline] nbd_ioctl+0x219/0xda0 drivers/block/nbd.c:1663 compat_blkdev_ioctl+0x2ee/0x7a0 block/ioctl.c:848 __do_compat_sys_ioctl fs/ioctl.c:695 [inline] __se_compat_sys_ioctl fs/ioctl.c:638 [inline] __ia32_compat_sys_ioctl+0x242/0x370 fs/ioctl.c:638 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe8/0x680 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf7fd3579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f54a555c EFLAGS: 00000296 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000004 RCX: 000000000000ab03 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 block nbd2: shutting down sockets ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi