Linux block layer
 help / color / mirror / Atom feed
* [PATCH V2] nbd: Reclassify sockets in the reconnect path
@ 2026-11-12 10:59 Guilherme Giacomo Simoes
  2026-11-12 21:26 ` Bart Van Assche
  0 siblings, 1 reply; 2+ messages in thread
From: Guilherme Giacomo Simoes @ 2026-11-12 10:59 UTC (permalink / raw)
  To: josef, axboe
  Cc: linux-block, nbd, linux-kernel, Guilherme Giacomo Simoes,
	syzbot+d7d72f3d467710442af0

Commit d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular
dependency") introduced nbd_reclassify_socket() to prevent lockdep false
positives when NBD sockets are used in memory reclaim paths. While
nbd_add_socket() reclassifies newly added sockets,
nbd_genl_reconnect_sock_cb() omitted this call when replacing dead
sockets during reconnection. Consequently, reconnected sockets retain
the generic socket lockdep class and trigger false-positive lockdep
reports.

Fix this by reclassifying the replacement socket in
nbd_genl_reconnect_sock_cb().

Fixes: d532cddb6c60 ("nbd: Reclassify sockets to avoid lockdep circular dependency")
Reported-by: syzbot+d7d72f3d467710442af0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=d7d72f3d467710442af0
Signed-off-by: Guilherme Giacomo Simoes <trintaeoitogc@gmail.com>
---
v2:
- change previous patch to a single line addition of
  nbd_reclassify_socket()
- improve commit message

v1: 
https://lore.kernel.org/all/20261110215723.199948-1-trintaeoitogc@gmail.com/
---
 drivers/block/nbd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index ffce519bf008..b2b27f90a7ed 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -1356,6 +1356,7 @@ static int nbd_genl_reconnect_sock_cb(struct nbd_device *nbd, unsigned long arg)
 	sock = nbd_get_socket(nbd, arg, &err);
 	if (!sock)
 		return err;
+	nbd_reclassify_socket(sock);
 
 	args = kzalloc_obj(*args);
 	if (!args) {
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH V2] nbd: Reclassify sockets in the reconnect path
  2026-11-12 10:59 [PATCH V2] nbd: Reclassify sockets in the reconnect path Guilherme Giacomo Simoes
@ 2026-11-12 21:26 ` Bart Van Assche
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Van Assche @ 2026-11-12 21:26 UTC (permalink / raw)
  To: Guilherme Giacomo Simoes, josef, axboe
  Cc: linux-block, nbd, linux-kernel, syzbot+d7d72f3d467710442af0

On 11/12/26 2:59 AM, Guilherme Giacomo Simoes wrote:
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index ffce519bf008..b2b27f90a7ed 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1356,6 +1356,7 @@ static int nbd_genl_reconnect_sock_cb(struct nbd_device *nbd, unsigned long arg)
>   	sock = nbd_get_socket(nbd, arg, &err);
>   	if (!sock)
>   		return err;
> +	nbd_reclassify_socket(sock);
>   
>   	args = kzalloc_obj(*args);
>   	if (!args) {

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-12 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 10:59 [PATCH V2] nbd: Reclassify sockets in the reconnect path Guilherme Giacomo Simoes
2026-11-12 21:26 ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox