Skip to content

Commit fdf3b11

Browse files
committed
nfsd: ensure that nfsd4_fattr_args.context is zeroed out
jira LE-2177 cve CVE-2024-46697 Rebuild_History Non-Buildable kernel-5.14.0-503.19.1.el9_5 commit-author Jeff Layton <[email protected]> commit f58bab6 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]> (cherry picked from commit f58bab6) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 618ba74 commit fdf3b11

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
@@ -3514,6 +3514,9 @@ nfsd4_encode_fattr4(struct svc_rqst *rqstp, struct xdr_stream *xdr,
35143514
args.dentry = dentry;
35153515
args.ignore_crossmnt = (ignore_crossmnt != 0);
35163516
args.acl = NULL;
3517+
#ifdef CONFIG_NFSD_V4_SECURITY_LABEL
3518+
args.context = NULL;
3519+
#endif
35173520

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

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

0 commit comments

Comments
 (0)