netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Vasily Averin <vvs@virtuozzo.com>,
	Eric Dumazet <edumazet@google.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH] tcp: detecting the misuse of .sendpage for Slab objects
Date: Wed, 6 Mar 2019 08:31:23 -0800	[thread overview]
Message-ID: <0651e79d-5dfa-1d2c-6c92-dccc5a9027a7@gmail.com> (raw)
In-Reply-To: <2a77e65a-9d81-9ddb-f7af-b3b6da095a10@virtuozzo.com>



On 03/06/2019 03:10 AM, Vasily Averin wrote:
> sendpage was not designed for processing of the Slab pages,
> in some situations it can trigger BUG_ON on receiving side.
> 
> Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
> ---
>  net/ipv4/tcp.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index ad07dd71063d..dbb08140cdc9 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -943,6 +943,10 @@ ssize_t do_tcp_sendpages(struct sock *sk, struct page *page, int offset,
>  	ssize_t copied;
>  	long timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT);
>  
> +	if (IS_ENABLED(CONFIG_DEBUG_VM) &&
> +	    WARN_ONCE(PageSlab(page), "page must not be a Slab one"))
> +		return -EINVAL;
> +
>  	/* Wait for a connection to finish. One exception is TCP Fast Open
>  	 * (passive side) where data is allowed to be sent before a connection
>  	 * is fully established.
> 

SGTM

David, this probably can be merged into net tree.

Signed-off-by: Eric Dumazet <edumazet@google.com>


  reply	other threads:[~2019-03-06 16:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-06 11:10 [PATCH] tcp: detecting the misuse of .sendpage for Slab objects Vasily Averin
2019-03-06 16:31 ` Eric Dumazet [this message]
2019-03-06 18:48 ` David Miller

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=0651e79d-5dfa-1d2c-6c92-dccc5a9027a7@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=edumazet@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=vvs@virtuozzo.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).