From: Haoxiang Li Date: Sat, 6 Dec 2025 07:38:42 +0000 (+0800) Subject: nfsd: Drop the client reference in client_states_open() X-Git-Tag: v5.10.248~118 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1badeef672a81e24503b9fbb3b847a6a1cf0ad4c;p=thirdparty%2Fkernel%2Fstable.git nfsd: Drop the client reference in client_states_open() commit 1f941b2c23fd34c6f3b76d36f9d0a2528fa92b8f upstream. In error path, call drop_client() to drop the reference obtained by get_nfsdfs_clp(). Fixes: 78599c42ae3c ("nfsd4: add file to display list of client's opens") Cc: stable@vger.kernel.org Reviewed-by: Jeff Layton Signed-off-by: Haoxiang Li Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1ac405bb5de2b..5417d3d8c0e2d 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -2802,8 +2802,10 @@ static int client_states_open(struct inode *inode, struct file *file) return -ENXIO; ret = seq_open(file, &states_seq_ops); - if (ret) + if (ret) { + drop_client(clp); return ret; + } s = file->private_data; s->private = clp; return 0;