All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] NFSv4.1: Fix nfs_client refcount leak in nfs41_free_stateid
@ 2026-06-25  3:20 zhang.guodong
  2026-06-25  3:20 ` [PATCH 2/2] pnfs/blocklayout: Fix device leaks on parse failure zhang.guodong
  0 siblings, 1 reply; 2+ messages in thread
From: zhang.guodong @ 2026-06-25  3:20 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: linux-nfs, ZhangGuoDong

From: ZhangGuoDong <zhangguodong@kylinos.cn>

nfs41_free_stateid() takes a reference on the nfs_client before
allocating the FREE_STATEID calldata. If the calldata allocation fails,
the function returns -ENOMEM without dropping that reference.

The normal async RPC release path drops the reference from
nfs41_free_stateid_release(), but that path is not reached when calldata
allocation fails. Drop the nfs_client reference before returning the
allocation error.

Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
---
 fs/nfs/nfs4proc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index c48281db3..b86818607 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -10380,8 +10380,10 @@ static int nfs41_free_stateid(struct nfs_server *server,
 
 	dprintk("NFS call  free_stateid %p\n", stateid);
 	data = kmalloc_obj(*data);
-	if (!data)
+	if (!data) {
+		nfs_put_client(clp);
 		return -ENOMEM;
+	}
 	data->server = server;
 	nfs4_stateid_copy(&data->args.stateid, stateid);
 
-- 
2.43.0


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

end of thread, other threads:[~2026-06-25  3:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-25  3:20 [PATCH 1/2] NFSv4.1: Fix nfs_client refcount leak in nfs41_free_stateid zhang.guodong
2026-06-25  3:20 ` [PATCH 2/2] pnfs/blocklayout: Fix device leaks on parse failure zhang.guodong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.