]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFSD: Fix SECINFO_NO_NAME decode error cleanup
authorGuannan Wang <wgnbuaa@gmail.com>
Thu, 21 May 2026 08:03:32 +0000 (16:03 +0800)
committerChuck Lever <cel@kernel.org>
Tue, 9 Jun 2026 20:32:59 +0000 (16:32 -0400)
nfsd4_decode_secinfo_no_name() currently initializes sin_exp after
decoding sin_style. If the XDR stream is truncated, the decoder returns
nfserr_bad_xdr before sin_exp is initialized.

Since commit 3fdc54646234 ("NFSD: Reduce amount of struct
nfsd4_compoundargs that needs clearing"), the inline iops array is not
cleared between RPC calls. A failed SECINFO_NO_NAME decode can therefore
leave sin_exp holding stale union contents from a previous operation.

The error response path still invokes nfsd4_secinfo_no_name_release(),
which calls exp_put() on a non-NULL sin_exp.

Initialize sin_exp before the first failable decode step, matching
nfsd4_decode_secinfo().

Fixes: 3fdc54646234 ("NFSD: Reduce amount of struct nfsd4_compoundargs that needs clearing")
Cc: stable@vger.kernel.org
Signed-off-by: Guannan Wang <wgnbuaa@gmail.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4xdr.c

index 20355dc3f1d162709e1dcd4bf2fdaf8f0fe32096..e17488a911f76589f343a7f144be3a1c73f1a138 100644 (file)
@@ -2008,10 +2008,11 @@ static __be32 nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
                                           union nfsd4_op_u *u)
 {
        struct nfsd4_secinfo_no_name *sin = &u->secinfo_no_name;
+
+       sin->sin_exp = NULL;
        if (xdr_stream_decode_u32(argp->xdr, &sin->sin_style) < 0)
                return nfserr_bad_xdr;
 
-       sin->sin_exp = NULL;
        return nfs_ok;
 }