Linux NFS development
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Jorge Mora <jmora1300@gmail.com>
Cc: linux-nfs@vger.kernel.org, jlayton@kernel.org
Subject: Re: [PATCH] NFSD: fix LISTXATTRS returning more bytes than maxcount
Date: Thu, 25 Jan 2024 13:03:08 -0500	[thread overview]
Message-ID: <ZbKiXLK9LocES/jZ@tissot.1015granger.net> (raw)
In-Reply-To: <20240125144223.12725-1-mora@netapp.com>

On Thu, Jan 25, 2024 at 07:42:23AM -0700, Jorge Mora wrote:
> The maxcount is the maximum number of bytes for the LISTXATTRS4resok
> result. This includes the cookie and the count for the name array,
> thus subtract 12 bytes from the maxcount: 8 (cookie) + 4 (array count)
> when filling up the name array.
> 
> Fixes: 23e50fe3a5e6 ("nfsd: implement the xattr functions and en/decode logic")
> Signed-off-by: Jorge Mora <mora@netapp.com>
> ---
>  fs/nfsd/nfs4xdr.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 92c7dde148a4..17e6404f4296 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -5168,7 +5168,8 @@ nfsd4_encode_listxattrs(struct nfsd4_compoundres *resp, __be32 nfserr,
>  	sp = listxattrs->lsxa_buf;
>  	nuser = 0;
>  
> -	xdrleft = listxattrs->lsxa_maxcount;
> +	/* Bytes left is maxcount - 8 (cookie) - 4 (array count) */
> +	xdrleft = listxattrs->lsxa_maxcount - 12;
>  
>  	while (left > 0 && xdrleft > 0) {
>  		slen = strlen(sp);
> -- 
> 2.43.0
> 

All four applied to nfsd-next.

Note this checkpatch complaint:

WARNING: From:/Signed-off-by: email address mismatch:
  'From: Jorge Mora <jmora1300@gmail.com>' != 'Signed-off-by: Jorge Mora <mora@netapp.com>'

I'm not sure whether that mismatch is a critical problem. These
look like good fixes and b4 says your DKIM is good, so I applied
them anyway.

-- 
Chuck Lever

      parent reply	other threads:[~2024-01-25 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 14:42 [PATCH] NFSD: fix LISTXATTRS returning more bytes than maxcount Jorge Mora
2024-01-25 17:02 ` Jeff Layton
2024-01-25 18:03 ` Chuck Lever [this message]

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=ZbKiXLK9LocES/jZ@tissot.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=jmora1300@gmail.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