block nbd7: NBD_DISCONNECT ====================================================== WARNING: possible circular locking dependency detected syzkaller #0 Not tainted ------------------------------------------------------ syz.7.1340/11147 is trying to acquire lock: ffff888055150f20 (sk_lock-AF_INET){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1693 [inline] ffff888055150f20 (sk_lock-AF_INET){+.+.}-{0:0}, at: tcp_sendmsg+0x21/0x50 net/ipv4/tcp.c:1411 but task is already holding lock: ffff88807c3b4c70 (&nsock->tx_lock){+.+.}-{4:4}, at: send_disconnects drivers/block/nbd.c:1405 [inline] ffff88807c3b4c70 (&nsock->tx_lock){+.+.}-{4:4}, at: nbd_disconnect+0x2d9/0x510 drivers/block/nbd.c:1421 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #5 (&nsock->tx_lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:770 nbd_handle_cmd drivers/block/nbd.c:1143 [inline] nbd_queue_rq+0x257/0xf10 drivers/block/nbd.c:1207 blk_mq_dispatch_rq_list+0x4c0/0x1900 block/blk-mq.c:2137 __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+0xdac/0x1570 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x348/0x4f0 block/blk-mq.c:2375 blk_mq_dispatch_list+0xd0c/0xe00 include/linux/spinlock.h:-1 blk_mq_flush_plug_list+0x469/0x550 block/blk-mq.c:2986 __blk_flush_plug+0x3d3/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] __submit_bio+0x2d3/0x5a0 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x2eb/0xa30 block/blk-core.c:755 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x599/0x830 fs/buffer.c:2447 filemap_read_folio+0x117/0x380 mm/filemap.c:2496 do_read_cache_folio+0x358/0x590 mm/filemap.c:4096 read_mapping_folio include/linux/pagemap.h:1017 [inline] read_part_sector+0xb6/0x2b0 block/partitions/core.c:722 adfspart_check_ICS+0xa4/0xa50 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+0x75f/0x14b0 block/partitions/core.c:693 blkdev_get_whole+0x380/0x510 block/bdev.c:765 bdev_open+0x31e/0xd30 block/bdev.c:974 blkdev_open+0x457/0x600 block/fops.c:703 do_dentry_open+0x7ce/0x1420 fs/open.c:962 vfs_open+0x3b/0x340 fs/open.c:1094 do_open fs/namei.c:4597 [inline] path_openat+0x33ce/0x3d90 fs/namei.c:4756 do_filp_open+0x1fa/0x410 fs/namei.c:4783 do_sys_openat2+0x121/0x200 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+0x138/0x170 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #4 (&cmd->lock){+.+.}-{4:4}: __mutex_lock_common kernel/locking/mutex.c:608 [inline] __mutex_lock+0x187/0x1350 kernel/locking/mutex.c:770 nbd_queue_rq+0xc8/0xf10 drivers/block/nbd.c:1199 blk_mq_dispatch_rq_list+0x4c0/0x1900 block/blk-mq.c:2137 __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+0xdac/0x1570 block/blk-mq-sched.c:307 blk_mq_sched_dispatch_requests+0xd7/0x190 block/blk-mq-sched.c:329 blk_mq_run_hw_queue+0x348/0x4f0 block/blk-mq.c:2375 blk_mq_dispatch_list+0xd0c/0xe00 include/linux/spinlock.h:-1 blk_mq_flush_plug_list+0x469/0x550 block/blk-mq.c:2986 __blk_flush_plug+0x3d3/0x4b0 block/blk-core.c:1225 blk_finish_plug block/blk-core.c:1252 [inline] __submit_bio+0x2d3/0x5a0 block/blk-core.c:651 __submit_bio_noacct_mq block/blk-core.c:724 [inline] submit_bio_noacct_nocheck+0x2eb/0xa30 block/blk-core.c:755 submit_bh fs/buffer.c:2829 [inline] block_read_full_folio+0x599/0x830 fs/buffer.c:2447 filemap_read_folio+0x117/0x380 mm/filemap.c:2496 do_read_cache_folio+0x358/0x590 mm/filemap.c:4096 read_mapping_folio include/linux/pagemap.h:1017 [inline] read_part_sector+0xb6/0x2b0 block/partitions/core.c:722 adfspart_check_ICS+0xa4/0xa50 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+0x75f/0x14b0 block/partitions/core.c:693 blkdev_get_whole+0x380/0x510 block/bdev.c:765 bdev_open+0x31e/0xd30 block/bdev.c:974 blkdev_open+0x457/0x600 block/fops.c:703 do_dentry_open+0x7ce/0x1420 fs/open.c:962 vfs_open+0x3b/0x340 fs/open.c:1094 do_open fs/namei.c:4597 [inline] path_openat+0x33ce/0x3d90 fs/namei.c:4756 do_filp_open+0x1fa/0x410 fs/namei.c:4783 do_sys_openat2+0x121/0x200 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+0x138/0x170 fs/open.c:1447 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #3 (set->srcu){.+.?}-{0:0}: srcu_lock_sync include/linux/srcu.h:197 [inline] __synchronize_srcu+0x96/0x390 kernel/rcu/srcutree.c:1503 blk_throtl_init+0x298/0x410 block/blk-throttle.c:1324 tg_set_conf+0x1c6/0x4b0 block/blk-throttle.c:1359 cgroup_file_write+0x3a1/0x740 kernel/cgroup/cgroup.c:4312 kernfs_fop_write_iter+0x3af/0x540 fs/kernfs/file.c:352 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5c9/0xb30 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #2 (&q->q_usage_counter(io)#17){++++}-{0:0}: blk_alloc_queue+0x538/0x620 block/blk-core.c:461 blk_mq_alloc_queue block/blk-mq.c:4410 [inline] __blk_mq_alloc_disk+0x15c/0x340 block/blk-mq.c:4457 loop_add+0x411/0xad0 drivers/block/loop.c:2206 loop_init+0xd9/0x170 drivers/block/loop.c:2441 do_one_initcall+0x1fb/0x820 init/main.c:1378 do_initcall_level+0x104/0x190 init/main.c:1440 do_initcalls+0x59/0xa0 init/main.c:1456 kernel_init_freeable+0x334/0x4b0 init/main.c:1688 kernel_init+0x1d/0x1d0 init/main.c:1578 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:4301 [inline] fs_reclaim_acquire+0x72/0x100 mm/page_alloc.c:4315 might_alloc include/linux/sched/mm.h:317 [inline] slab_pre_alloc_hook mm/slub.c:4899 [inline] slab_alloc_node mm/slub.c:5234 [inline] kmem_cache_alloc_node_noprof+0x48/0x710 mm/slub.c:5310 __alloc_skb+0x255/0x430 net/core/skbuff.c:679 alloc_skb_fclone include/linux/skbuff.h:1433 [inline] tcp_stream_alloc_skb+0x3d/0x350 net/ipv4/tcp.c:910 tcp_sendmsg_locked+0x1ab8/0x5520 net/ipv4/tcp.c:1217 tcp_sendmsg+0x2f/0x50 net/ipv4/tcp.c:1412 sock_sendmsg_nosec+0x128/0x1d0 net/socket.c:728 __sock_sendmsg net/socket.c:743 [inline] sock_write_iter+0x2d9/0x3d0 net/socket.c:1201 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5c9/0xb30 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f -> #0 (sk_lock-AF_INET){+.+.}-{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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 lock_sock_nested+0x48/0x100 net/core/sock.c:3762 lock_sock include/net/sock.h:1693 [inline] tcp_sendmsg+0x21/0x50 net/ipv4/tcp.c:1411 sock_sendmsg_nosec+0x128/0x1d0 net/socket.c:728 __sock_sendmsg net/socket.c:743 [inline] sock_sendmsg+0x192/0x280 net/socket.c:766 __sock_xmit+0x25f/0x530 drivers/block/nbd.c:576 sock_xmit drivers/block/nbd.c:605 [inline] send_disconnects drivers/block/nbd.c:1406 [inline] nbd_disconnect+0x384/0x510 drivers/block/nbd.c:1421 __nbd_ioctl drivers/block/nbd.c:1601 [inline] nbd_ioctl+0xabc/0xe10 drivers/block/nbd.c:1663 blkdev_ioctl+0x60e/0x710 block/ioctl.c:707 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 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: sk_lock-AF_INET --> &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); *** DEADLOCK *** 2 locks held by syz.7.1340/11147: #0: ffff888025dda278 (&nbd->config_lock){+.+.}-{4:4}, at: nbd_ioctl+0x131/0xe10 drivers/block/nbd.c:1656 #1: ffff88807c3b4c70 (&nsock->tx_lock){+.+.}-{4:4}, at: send_disconnects drivers/block/nbd.c:1405 [inline] #1: ffff88807c3b4c70 (&nsock->tx_lock){+.+.}-{4:4}, at: nbd_disconnect+0x2d9/0x510 drivers/block/nbd.c:1421 stack backtrace: CPU: 1 UID: 0 PID: 11147 Comm: syz.7.1340 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_circular_bug+0x2e2/0x300 kernel/locking/lockdep.c:2043 check_noncircular+0x12e/0x150 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+0x15a6/0x2cf0 kernel/locking/lockdep.c:5237 lock_acquire+0x117/0x340 kernel/locking/lockdep.c:5868 lock_sock_nested+0x48/0x100 net/core/sock.c:3762 lock_sock include/net/sock.h:1693 [inline] tcp_sendmsg+0x21/0x50 net/ipv4/tcp.c:1411 sock_sendmsg_nosec+0x128/0x1d0 net/socket.c:728 __sock_sendmsg net/socket.c:743 [inline] sock_sendmsg+0x192/0x280 net/socket.c:766 __sock_xmit+0x25f/0x530 drivers/block/nbd.c:576 sock_xmit drivers/block/nbd.c:605 [inline] send_disconnects drivers/block/nbd.c:1406 [inline] nbd_disconnect+0x384/0x510 drivers/block/nbd.c:1421 __nbd_ioctl drivers/block/nbd.c:1601 [inline] nbd_ioctl+0xabc/0xe10 drivers/block/nbd.c:1663 blkdev_ioctl+0x60e/0x710 block/ioctl.c:707 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:597 [inline] __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa469f8f749 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:00007fa46ae92038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fa46a1e6090 RCX: 00007fa469f8f749 RDX: 0000000000000000 RSI: 000000000000ab08 RDI: 0000000000000003 RBP: 00007fa46a013f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fa46a1e6128 R14: 00007fa46a1e6090 R15: 00007ffdf833d028 block nbd7: Send disconnect failed -32 block nbd7: Send disconnect failed -32 block nbd7: Disconnected due to user request. block nbd7: shutting down sockets