nfsd: ensure that nfsd4_fattr_args.context is zeroed out

BugLink: https://bugs.launchpad.net/bugs/2084225

[ Upstream commit f58bab6fd4063913bd8321e99874b8239e9ba726 ]

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: f59388a579 ("NFSD: Add nfsd4_encode_fattr4_sec_label()")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[koichiroden: Adjusted context based on Ubuntu Sauce patches]
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
This commit is contained in:
Jeff Layton
2024-08-22 14:47:01 -04:00
committed by Mehmet Basaran
parent ddc6891b6f
commit 278ca0e589
+3
View File
@@ -3512,6 +3512,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.context = NULL;
#endif
/*
* Make a local copy of the attribute bitmap that can be modified.