Skip to content

Commit c8a24ef

Browse files
keenanwgngregkh
authored andcommitted
NFSD: Fix SECINFO_NO_NAME decode error cleanup
commit 9e18e83 upstream. 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 3fdc546 ("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: 3fdc546 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6a94603 commit c8a24ef

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

fs/nfsd/nfs4xdr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1871,10 +1871,11 @@ static __be32 nfsd4_decode_secinfo_no_name(struct nfsd4_compoundargs *argp,
18711871
union nfsd4_op_u *u)
18721872
{
18731873
struct nfsd4_secinfo_no_name *sin = &u->secinfo_no_name;
1874+
1875+
sin->sin_exp = NULL;
18741876
if (xdr_stream_decode_u32(argp->xdr, &sin->sin_style) < 0)
18751877
return nfserr_bad_xdr;
18761878

1877-
sin->sin_exp = NULL;
18781879
return nfs_ok;
18791880
}
18801881

0 commit comments

Comments
 (0)