possible deadlock in nbd_disconnect_and_put

Status: upstream: reported on 2026/02/17 19:49
Subsystems: nbd
Labels: prio:low
[Documentation on labels]
Reported-by: syzbot+3add0454d5a2619b8e80@syzkaller.appspotmail.com
First crash: 182d, last: 10d
✨ AI Jobs (3)
ID Workflow Result Correct Bug Created Started Finished Revision
27bb1eda assessment-security DenialOfService: ❌ Exploitable: ❌ FilesystemTrigger: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ possible deadlock in nbd_disconnect_and_put 2026/05/30 07:38 2026/05/30 07:38 2026/05/30 08:38 6b4a8443
8ce3e094 assessment-security 💥 possible deadlock in nbd_disconnect_and_put 2026/05/14 08:37 2026/05/14 08:37 2026/05/14 08:38 6ccb967e
8b79b13b repro possible deadlock in nbd_disconnect_and_put 2026/03/06 07:38 2026/03/06 07:38 2026/03/06 07:48 31e9c887
Discussions (2)
Title Replies (including bot) Last reply
[PATCH] nbd: fix circular lock dependency in nbd_disconnect_and_put 2 (2) 2026/07/19 12:26
[syzbot] [nbd?] possible deadlock in nbd_disconnect_and_put 0 (1) 2026/02/17 19:49

Sample crash report:
block nbd8: NBD_DISCONNECT
block nbd8: Send disconnect failed -32
block nbd8: shutting down sockets
======================================================
WARNING: possible circular locking dependency detected
syzkaller #0 Tainted: G             L     
------------------------------------------------------
syz.8.7980/30577 is trying to acquire lock:
ffff888027ade940 ((wq_completion)nbd8-recv){+.+.}-{0:0}, at: touch_wq_lockdep_map+0x9c/0x1c0 kernel/workqueue.c:4037

but task is already holding lock:
ffff888027a5f260 (&nbd->config_lock){+.+.}-{4:4}, at: nbd_disconnect_and_put+0x26/0x1c0 drivers/block/nbd.c:2293

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&nbd->config_lock){+.+.}-{4:4}:
       lock_acquire kernel/locking/lockdep.c:5868 [inline]
       lock_acquire+0x1b9/0x370 kernel/locking/lockdep.c:5825
       __mutex_lock_common kernel/locking/mutex.c:646 [inline]
       __mutex_lock+0x1a4/0x1bd0 kernel/locking/mutex.c:821
       refcount_dec_and_mutex_lock+0x51/0x100 lib/refcount.c:118
       nbd_config_put+0x31/0x750 drivers/block/nbd.c:1471
       recv_work+0x63a/0x8c0 drivers/block/nbd.c:1026
       process_one_work+0xa23/0x1940 kernel/workqueue.c:3322
       process_scheduled_works kernel/workqueue.c:3405 [inline]
       worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486
       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

-> #1 ((work_completion)(&args->work)){+.+.}-{0:0}:
       lock_acquire kernel/locking/lockdep.c:5868 [inline]
       lock_acquire+0x1b9/0x370 kernel/locking/lockdep.c:5825
       process_one_work+0x98e/0x1940 kernel/workqueue.c:3298
       process_scheduled_works kernel/workqueue.c:3405 [inline]
       worker_thread+0x5ef/0xe50 kernel/workqueue.c:3486
       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

-> #0 ((wq_completion)nbd8-recv){+.+.}-{0:0}:
       check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3165
       check_prevs_add kernel/locking/lockdep.c:3284 [inline]
       validate_chain kernel/locking/lockdep.c:3908 [inline]
       __lock_acquire+0x136c/0x1a40 kernel/locking/lockdep.c:5237
       lock_acquire kernel/locking/lockdep.c:5868 [inline]
       lock_acquire+0x1b9/0x370 kernel/locking/lockdep.c:5825
       touch_wq_lockdep_map+0xad/0x1c0 kernel/workqueue.c:4037
       __flush_workqueue+0x131/0x1200 kernel/workqueue.c:4079
       nbd_disconnect_and_put+0x9b/0x1c0 drivers/block/nbd.c:2301
       nbd_genl_disconnect+0x34b/0x4e0 drivers/block/nbd.c:2340
       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:2556
       genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1900
       sock_sendmsg_nosec net/socket.c:775 [inline]
       __sock_sendmsg net/socket.c:790 [inline]
       ____sys_sendmsg+0xa4d/0xbe0 net/socket.c:2684
       ___sys_sendmsg+0x190/0x1e0 net/socket.c:2738
       __sys_sendmsg+0x160/0x210 net/socket.c:2770
       do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
       do_syscall_64+0x115/0x870 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:
  (wq_completion)nbd8-recv --> (work_completion)(&args->work) --> &nbd->config_lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&nbd->config_lock);
                               lock((work_completion)(&args->work));
                               lock(&nbd->config_lock);
  lock((wq_completion)nbd8-recv);

 *** DEADLOCK ***

3 locks held by syz.8.7980/30577:
 #0: ffffffff90b4a748 (cb_lock){++++}-{4:4}, at: genl_rcv+0x19/0x40 net/netlink/genetlink.c:1217
 #1: ffffffff90b4a800 (genl_mutex){+.+.}-{4:4}, at: genl_lock net/netlink/genetlink.c:35 [inline]
 #1: ffffffff90b4a800 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:60 [inline]
 #1: ffffffff90b4a800 (genl_mutex){+.+.}-{4:4}, at: genl_op_lock net/netlink/genetlink.c:57 [inline]
 #1: ffffffff90b4a800 (genl_mutex){+.+.}-{4:4}, at: genl_rcv_msg+0x57b/0x800 net/netlink/genetlink.c:1208
 #2: ffff888027a5f260 (&nbd->config_lock){+.+.}-{4:4}, at: nbd_disconnect_and_put+0x26/0x1c0 drivers/block/nbd.c:2293

stack backtrace:
CPU: 0 UID: 0 PID: 30577 Comm: syz.8.7980 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/16/2026
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
 print_circular_bug.cold+0x178/0x1c7 kernel/locking/lockdep.c:2043
 check_noncircular+0x146/0x160 kernel/locking/lockdep.c:2175
 check_prev_add+0xeb/0xe60 kernel/locking/lockdep.c:3165
 check_prevs_add kernel/locking/lockdep.c:3284 [inline]
 validate_chain kernel/locking/lockdep.c:3908 [inline]
 __lock_acquire+0x136c/0x1a40 kernel/locking/lockdep.c:5237
 lock_acquire kernel/locking/lockdep.c:5868 [inline]
 lock_acquire+0x1b9/0x370 kernel/locking/lockdep.c:5825
 touch_wq_lockdep_map+0xad/0x1c0 kernel/workqueue.c:4037
 __flush_workqueue+0x131/0x1200 kernel/workqueue.c:4079
 nbd_disconnect_and_put+0x9b/0x1c0 drivers/block/nbd.c:2301
 nbd_genl_disconnect+0x34b/0x4e0 drivers/block/nbd.c:2340
 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:2556
 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1218
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x585/0x850 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x8b0/0xda0 net/netlink/af_netlink.c:1900
 sock_sendmsg_nosec net/socket.c:775 [inline]
 __sock_sendmsg net/socket.c:790 [inline]
 ____sys_sendmsg+0xa4d/0xbe0 net/socket.c:2684
 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2738
 __sys_sendmsg+0x160/0x210 net/socket.c:2770
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x115/0x870 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5bf619e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5bf710f028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f5bf6426090 RCX: 00007f5bf619e0d9
RDX: 0000000004000810 RSI: 00002000000002c0 RDI: 0000000000000004
RBP: 00007f5bf6235024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5bf6426128 R14: 00007f5bf6426090 R15: 00007ffdd0457f58
 </TASK>

Crashes (5):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/07 09:37 upstream f9a2394a2348 c38879ea .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root possible deadlock in nbd_disconnect_and_put
2026/06/28 15:08 upstream 780d569e6c4b fb92f11c .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-root possible deadlock in nbd_disconnect_and_put
2026/07/07 23:49 upstream 0e35b9b6ec0f 88a4b44c .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in nbd_disconnect_and_put
2026/05/15 21:46 upstream d458a240344c 81fb92f3 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 possible deadlock in nbd_disconnect_and_put
2026/02/16 16:36 linux-next 635c467cc14e 5d52cba5 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-rust-kasan-gce possible deadlock in nbd_disconnect_and_put
* Struck through repros no longer work on HEAD.