All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, anna.schumaker@netapp.com, zlang@redhat.com
Subject: Re: [PATCH v2] SUNRPC: Fix READ_PLUS crasher
Date: Fri, 1 Jul 2022 10:17:52 -0400	[thread overview]
Message-ID: <20220701141752.GA13890@fieldses.org> (raw)
In-Reply-To: <165662209842.1459.4593520026847863736.stgit@klimt.1015granger.net>

This also gets through my tests without a crash.--b.

On Thu, Jun 30, 2022 at 04:48:18PM -0400, Chuck Lever wrote:
> Looks like there are still cases when "space_left - frag1bytes" can
> legitimately exceed PAGE_SIZE. Ensure that xdr->end always remains
> within the current encode buffer.
> 
> Reported-by: Bruce Fields <bfields@fieldses.org>
> Reported-by: Zorro Lang <zlang@redhat.com>
> Link: https://bugzilla.kernel.org/show_bug.cgi?id=216151
> Fixes: 6c254bf3b637 ("SUNRPC: Fix the calculation of xdr->end in xdr_get_next_encode_buffer()")
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  net/sunrpc/xdr.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c
> index f87a2d8f23a7..5d2b3e6979fb 100644
> --- a/net/sunrpc/xdr.c
> +++ b/net/sunrpc/xdr.c
> @@ -984,7 +984,7 @@ static noinline __be32 *xdr_get_next_encode_buffer(struct xdr_stream *xdr,
>  	p = page_address(*xdr->page_ptr);
>  	xdr->p = p + frag2bytes;
>  	space_left = xdr->buf->buflen - xdr->buf->len;
> -	if (space_left - nbytes >= PAGE_SIZE)
> +	if (space_left - frag1bytes >= PAGE_SIZE)
>  		xdr->end = p + PAGE_SIZE;
>  	else
>  		xdr->end = p + space_left - frag1bytes;
> 

  reply	other threads:[~2022-07-01 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30 20:48 [PATCH v2] SUNRPC: Fix READ_PLUS crasher Chuck Lever
2022-07-01 14:17 ` J. Bruce Fields [this message]
2022-07-04  6:55 ` Zorro Lang
2022-07-04 16:16   ` Chuck Lever III

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=20220701141752.GA13890@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=anna.schumaker@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=zlang@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.