Commit f58bab6f authored by Jeff Layton's avatar Jeff Layton Committed by Chuck Lever
Browse files

nfsd: ensure that nfsd4_fattr_args.context is zeroed out



If nfsd4_encode_fattr4 ends up doing a "goto out" before we get to
checking for the security label, then args.context will be set to
uninitialized junk on the stack, which we'll then try to free.
Initialize it early.

Fixes: f59388a5 ("NFSD: Add nfsd4_encode_fattr4_sec_label()")
Signed-off-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 91da337e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -3545,6 +3545,9 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
	args.dentry = dentry;
	args.ignore_crossmnt = (ignore_crossmnt != 0);
	args.acl = NULL;
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
	args.context = NULL;
#endif

	/*
	 * Make a local copy of the attribute bitmap that can be modified.
@@ -3617,7 +3620,6 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
	args.contextsupport = false;

#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
	args.context = NULL;
	if ((attrmask[2] & FATTR4_WORD2_SECURITY_LABEL) ||
	     attrmask[0] & FATTR4_WORD0_SUPPORTED_ATTRS) {
		if (exp->ex_flags & NFSEXP_SECURITY_LABEL)