====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Tainted: G L ------------------------------------------------------ kworker/u9:2/5618 is trying to acquire lock: ffff888053cedf20 (sk_lock-AF_INET-NBD){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1717 [inline] ffff888053cedf20 (sk_lock-AF_INET-NBD){+.+.}-{0:0}, at: inet_shutdown+0x67/0x410 net/ipv4/af_inet.c:911 but task is already holding lock: ffff88802c92e668 (&nsock->tx_lock){+.+.}-{4:4}, at: recv_work+0x5e7/0x8c0 drivers/block/nbd.c:1029 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #6 (&nsock->tx_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x42d/0xfa0 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x428/0x1e60 block/blk-mq.c:2141 __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+0xcea/0x1620 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x1c0 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x130/0x380 block/blk-mq.c:2555 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #5 (&cmd->lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 nbd_queue_rq+0xba/0xfa0 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x428/0x1e60 block/blk-mq.c:2141 __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+0xcea/0x1620 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x1c0 block/blk-mq-sched.c:329 blk_mq_run_work_fn+0x130/0x380 block/blk-mq.c:2555 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #4 (set->srcu){.+.+}-{0:0}: lock_sync kernel/locking/lockdep.c:5991 [inline] lock_sync+0xb5/0x120 kernel/locking/lockdep.c:5979 srcu_lock_sync include/linux/srcu.h:225 [inline] __synchronize_srcu+0xa2/0x310 kernel/rcu/srcutree.c:1662 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/0x1c0 block/blk-mq.c:299 elevator_switch+0x17b/0x7e0 block/elevator.c:576 elevator_change+0x352/0x530 block/elevator.c:681 elevator_set_default+0x29e/0x360 block/elevator.c:754 blk_register_queue+0x49e/0x640 block/blk-sysfs.c:992 __add_disk+0x7dd/0xf10 block/genhd.c:531 add_disk_fwnode+0x118/0x480 block/genhd.c:600 add_disk include/linux/blkdev.h:801 [inline] nbd_dev_add+0x779/0xb10 drivers/block/nbd.c:2026 nbd_init+0x2c5/0x2e0 drivers/block/nbd.c:2743 do_one_initcall+0x11c/0x6f0 init/main.c:1419 do_initcall_level init/main.c:1481 [inline] do_initcalls init/main.c:1497 [inline] do_basic_setup init/main.c:1517 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1732 kernel_init+0x21/0x1e0 init/main.c:1622 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #3 (&q->elevator_lock){+.+.}-{4:4}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __mutex_lock_common kernel/locking/mutex.c:646 [inline] __mutex_lock+0x19f/0x1c10 kernel/locking/mutex.c:821 elevator_change+0x1bc/0x530 block/elevator.c:679 elv_iosched_store+0x3be/0x460 block/elevator.c:826 queue_attr_store+0x25f/0x2f0 block/blk-sysfs.c:906 sysfs_kf_write+0xf2/0x150 fs/sysfs/file.c:145 kernfs_fop_write_iter+0x3e0/0x5f0 fs/kernfs/file.c:345 new_sync_write fs/read_write.c:595 [inline] vfs_write+0x6af/0x1050 fs/read_write.c:687 ksys_write+0x12a/0x250 fs/read_write.c:739 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 -> #2 (&q->q_usage_counter(io)#17){++++}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 blk_alloc_queue+0x610/0x790 block/blk-core.c:505 blk_mq_alloc_queue+0x174/0x290 block/blk-mq.c:4460 __blk_mq_alloc_disk+0x29/0x120 block/blk-mq.c:4507 loop_add+0x498/0xb60 drivers/block/loop.c:1971 loop_init+0x1d3/0x200 drivers/block/loop.c:2210 do_one_initcall+0x11c/0x6f0 init/main.c:1419 do_initcall_level init/main.c:1481 [inline] do_initcalls init/main.c:1497 [inline] do_basic_setup init/main.c:1517 [inline] kernel_init_freeable+0x6ea/0x7b0 init/main.c:1732 kernel_init+0x21/0x1e0 init/main.c:1622 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 -> #1 (fs_reclaim){+.+.}-{0:0}: lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 __fs_reclaim_acquire mm/page_alloc.c:4360 [inline] fs_reclaim_acquire+0xc4/0x100 mm/page_alloc.c:4374 might_alloc include/linux/sched/mm.h:316 [inline] slab_pre_alloc_hook mm/slub.c:4673 [inline] slab_alloc_node mm/slub.c:5011 [inline] __kmalloc_cache_noprof+0x63/0x6d0 mm/slub.c:5676 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] tcp_sendmsg_fastopen+0x24d/0x750 net/ipv4/tcp.c:1070 tcp_sendmsg_locked+0x28ba/0x46b0 net/ipv4/tcp.c:1187 tcp_sendmsg+0x2e/0x50 net/ipv4/tcp.c:1462 inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:864 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:818 [inline] __sys_sendto+0x470/0x4e0 net/socket.c:2283 __do_sys_sendto net/socket.c:2290 [inline] __se_sys_sendto net/socket.c:2286 [inline] __x64_sys_sendto+0xe0/0x1c0 net/socket.c:2286 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 -> #0 (sk_lock-AF_INET-NBD){+.+.}-{0:0}: check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 lock_sock_nested+0x41/0xf0 net/core/sock.c:3908 lock_sock include/net/sock.h:1717 [inline] inet_shutdown+0x67/0x410 net/ipv4/af_inet.c:911 nbd_mark_nsock_dead+0xae/0x5c0 drivers/block/nbd.c:319 recv_work+0x5fb/0x8c0 drivers/block/nbd.c:1030 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 other info that might help us debug this: Chain exists of: sk_lock-AF_INET-NBD --> &cmd->lock --> &nsock->tx_lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&nsock->tx_lock); lock(&cmd->lock); lock(&nsock->tx_lock); lock(sk_lock-AF_INET-NBD); *** DEADLOCK *** locks held by kworker/u9:2/5618: 3, last CPU#0: #0: ffff888029884148 ((wq_completion)nbd0-recv){+.+.}-{0:0}, at: process_one_work+0x1461/0x1b10 kernel/workqueue.c:3470 #1: ffffc900038bfd08 ((work_completion)(&args->work)){+.+.}-{0:0}, at: process_one_work+0xa2c/0x1b10 kernel/workqueue.c:3471 #2: ffff88802c92e668 (&nsock->tx_lock){+.+.}-{4:4}, at: recv_work+0x5e7/0x8c0 drivers/block/nbd.c:1029 stack backtrace: CPU: 0 UID: 0 PID: 5618 Comm: kworker/u9:2 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/15/2026 Workqueue: nbd0-recv recv_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_circular_bug.cold+0x178/0x1be kernel/locking/lockdep.c:2087 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2219 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3209 check_prevs_add kernel/locking/lockdep.c:3328 [inline] validate_chain kernel/locking/lockdep.c:3952 [inline] __lock_acquire+0x1528/0x1f40 kernel/locking/lockdep.c:5288 lock_acquire kernel/locking/lockdep.c:5942 [inline] lock_acquire+0x1d1/0x380 kernel/locking/lockdep.c:5899 lock_sock_nested+0x41/0xf0 net/core/sock.c:3908 lock_sock include/net/sock.h:1717 [inline] inet_shutdown+0x67/0x410 net/ipv4/af_inet.c:911 nbd_mark_nsock_dead+0xae/0x5c0 drivers/block/nbd.c:319 recv_work+0x5fb/0x8c0 drivers/block/nbd.c:1030 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245