nbd: Reclassify sockets to avoid lockdep circular dependency
authorEric Dumazet <edumazet@google.com>
Sat, 13 Jun 2026 04:26:19 +0000 (04:26 +0000)
committerJens Axboe <axboe@kernel.dk>
Sat, 13 Jun 2026 12:34:34 +0000 (06:34 -0600)
commitd532cddb6c6049ced414d64d83c6ce7149a6421a
tree8f6571fb1cf0c7087ab584a07828a1e3f993ee44
parente8dcf2d142bd720c8334233ad6cfdf00f0e76b7f
nbd: Reclassify sockets to avoid lockdep circular dependency

syzbot reported a possible circular locking dependency in udp_sendmsg()
where fs_reclaim can be triggered while holding sk_lock, and fs_reclaim
can eventually depend on another sk_lock (e.g., if NBD is used for swap
or writeback and NBD uses TLS/TCP which acquires sk_lock).

Since the UDP socket and the NBD TCP/TLS socket are different, this is a
false positive. Fix this by reclassifying NBD sockets to a separate lock
class when they are added to the NBD device.

This is similar to what nvme-tcp and other network block devices do.

Fixes: ffa1e7ada456 ("block: Make request_queue lockdep splats show up earlier")
Reported-by: syzbot+607cdcf978b3e79da878@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6a2cdafe.428ffe26.258b27.0161.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20260613042619.1108126-1-edumazet@google.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/nbd.c