Skip to content

Commit

Permalink
NFSD: Finish converting the NFSv2 GETACL result encoder
Browse files Browse the repository at this point in the history
[ Upstream commit ea5021e ]

The xdr_stream conversion inadvertently left some code that set the
page_len of the send buffer. The XDR stream encoders should handle
this automatically now.

This oversight adds garbage past the end of the Reply message.
Clients typically ignore the garbage, but NFSD does not need to send
it, as it leaks stale memory contents onto the wire.

Fixes: f8cba47 ("NFSD: Update the NFSv2 GETACL result encoder to use struct xdr_stream")
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
chucklever authored and gregkh committed Dec 31, 2022
1 parent e498675 commit 5030d4d
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions fs/nfsd/nfs2acl.c
Expand Up @@ -246,7 +246,6 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
struct nfsd3_getaclres *resp = rqstp->rq_resp;
struct dentry *dentry = resp->fh.fh_dentry;
struct inode *inode;
int w;

if (!svcxdr_encode_stat(xdr, resp->status))
return false;
Expand All @@ -260,15 +259,6 @@ static int nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, __be32 *p)
if (xdr_stream_encode_u32(xdr, resp->mask) < 0)
return false;

rqstp->rq_res.page_len = w = nfsacl_size(
(resp->mask & NFS_ACL) ? resp->acl_access : NULL,
(resp->mask & NFS_DFACL) ? resp->acl_default : NULL);
while (w > 0) {
if (!*(rqstp->rq_next_page++))
return true;
w -= PAGE_SIZE;
}

if (!nfs_stream_encode_acl(xdr, inode, resp->acl_access,
resp->mask & NFS_ACL, 0))
return false;
Expand Down

0 comments on commit 5030d4d

Please sign in to comment.