* [PATCH] nbd: reclassify socket lock in nbd_reconnect_socket
@ 2026-07-06 15:57 Yun Zhou
2026-07-19 12:27 ` Zhou, Yun
0 siblings, 1 reply; 2+ messages in thread
From: Yun Zhou @ 2026-07-06 15:57 UTC (permalink / raw)
To: josef, axboe; +Cc: linux-block, nbd, linux-kernel, yun.zhou
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@syzkaller.appspotmail.com
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@windriver.com>
---
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);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nbd: reclassify socket lock in nbd_reconnect_socket
2026-07-06 15:57 [PATCH] nbd: reclassify socket lock in nbd_reconnect_socket Yun Zhou
@ 2026-07-19 12:27 ` Zhou, Yun
0 siblings, 0 replies; 2+ messages in thread
From: Zhou, Yun @ 2026-07-19 12:27 UTC (permalink / raw)
To: josef, axboe; +Cc: linux-block, nbd, linux-kernel
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@syzkaller.appspotmail.com
> 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@windriver.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-19 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-06 15:57 [PATCH] nbd: reclassify socket lock in nbd_reconnect_socket Yun Zhou
2026-07-19 12:27 ` Zhou, Yun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®