From: zhang.guodong@linux.dev
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, ZhangGuoDong <zhangguodong@kylinos.cn>
Subject: [PATCH 1/2] NFSv4.1: Fix nfs_client refcount leak in nfs41_free_stateid
Date: Thu, 25 Jun 2026 11:20:37 +0800 [thread overview]
Message-ID: <20260625032038.11535-1-zhang.guodong@linux.dev> (raw)
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
next reply other threads:[~2026-06-25 3:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 3:20 zhang.guodong [this message]
2026-06-25 3:20 ` [PATCH 2/2] pnfs/blocklayout: Fix device leaks on parse failure zhang.guodong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260625032038.11535-1-zhang.guodong@linux.dev \
--to=zhang.guodong@linux.dev \
--cc=anna@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
--cc=zhangguodong@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.