Re: [PATCH] nbd: reclassify socket lock in nbd_reconnect_socket
From: Zhou, Yun
Date: Sun Jul 19 2026 - 08:28:51 EST
Friendly ping.
On 7/6/2026 11:57 PM, Yun Zhou wrote:
nbd_reconnect_socket() obtains a new socket via nbd_get_socket() but
does not call nbd_reclassify_socket(), leaving the socket's sk_lock in
the default AF_INET6 lockdep class. This causes false circular lock
dependency warnings because lockdep merges the NBD socket's sk_lock
with unrelated sockets (e.g., rawv6_sendmsg) that establish a
sk_lock -> fs_reclaim dependency in normal operation.
nbd_add_socket() already reclassifies correctly on the initial connect
path, but the reconnect path was missed.
Add the missing nbd_reclassify_socket() call after nbd_get_socket() in
nbd_reconnect_socket().
Reported-by: syzbot+576095eed5658cbd9b63@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=576095eed5658cbd9b63
Fixes: d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency")
Signed-off-by: Yun Zhou <yun.zhou@xxxxxxxxxxxxx>
---
drivers/block/nbd.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 8c6028e71e83..70a04d541ea4 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1386,6 +1386,8 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg)
if (!sock)
return err;
+ nbd_reclassify_socket(sock);
+
args = kzalloc_obj(*args);
if (!args) {
sockfd_put(sock);