Skip to content

Commit f58bab6

Browse files
jtlaytonchucklever
authored andcommitted
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: f59388a ("NFSD: Add nfsd4_encode_fattr4_sec_label()") Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 91da337 commit f58bab6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfsd/nfs4xdr.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3545,6 +3545,9 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
35453545
args.dentry = dentry;
35463546
args.ignore_crossmnt = (ignore_crossmnt != 0);
35473547
args.acl = NULL;
3548+
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3549+
args.context = NULL;
3550+
#endif
35483551

35493552
/*
35503553
* 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,
36173620
args.contextsupport = false;
36183621

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

0 commit comments

Comments
 (0)