public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1 2/3] NFSD: Finish converting the NFSv2 GETACL result encoder
Date: Mon, 17 Oct 2022 09:02:32 -0400	[thread overview]
Message-ID: <f636f0470c83d7b39a7a223dbb20d2e7cb6b5f86.camel@kernel.org> (raw)
In-Reply-To: <166593522241.1710.1607659813797998942.stgit@klimt.1015granger.net>

On Sun, 2022-10-16 at 11:47 -0400, Chuck Lever wrote:
> 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: f8cba47344f7 ("NFSD: Update the NFSv2 GETACL result encoder to use struct xdr_stream")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  fs/nfsd/nfs2acl.c |   10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c
> index 9edd3c1a30fb..87f224cd30a8 100644
> --- a/fs/nfsd/nfs2acl.c
> +++ b/fs/nfsd/nfs2acl.c
> @@ -246,7 +246,6 @@ nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
>  	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;
> @@ -260,15 +259,6 @@ nfsaclsvc_encode_getaclres(struct svc_rqst *rqstp, struct xdr_stream *xdr)
>  	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;
> 
> 

That makes a lot more sense now.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2022-10-17 13:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 15:46 [PATCH 1 1/3] SUNRPC: Remove unused svc_rqst::rq_lock field Chuck Lever
2022-10-16 15:47 ` [PATCH 1 2/3] NFSD: Finish converting the NFSv2 GETACL result encoder Chuck Lever
2022-10-17 13:02   ` Jeff Layton [this message]
2022-10-16 15:47 ` [PATCH 1 3/3] NFSD: Finish converting the NFSv3 " Chuck Lever
2022-10-17 13:04   ` Jeff Layton
2022-10-17 12:55 ` [PATCH 1 1/3] SUNRPC: Remove unused svc_rqst::rq_lock field Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f636f0470c83d7b39a7a223dbb20d2e7cb6b5f86.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox