netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Soheil Hassas Yeganeh <soheil@google.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Willem de Bruijn <willemb@google.com>
Subject: Re: [PATCH net-next] tcp: cleanup sk_tx_skb_cache before reuse
Date: Fri, 29 Mar 2019 15:50:16 -0400	[thread overview]
Message-ID: <CACSApvbBEfDzsY2NCK2xsCK9t4zY5mMQX14SGrtOG7vumZmufw@mail.gmail.com> (raw)
In-Reply-To: <20190329194617.195528-1-edumazet@google.com>

On Fri, Mar 29, 2019 at 3:46 PM Eric Dumazet <edumazet@google.com> wrote:
>
> TCP stack relies on the fact that a freshly allocated skb
> has skb->cb[] and skb_shinfo(skb)->tx_flags cleared.
>
> When recycling tx skb, we must ensure these fields are cleared.
>
> Fixes: 472c2e07eef0 ("tcp: add one skb cache for tx")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Soheil Hassas Yeganeh <soheil@google.com>
> Cc: Willem de Bruijn <willemb@google.com>

Acked-by: Soheil Hassas Yeganeh <soheil@google.com>

Nice catch! Thank you!

> ---
>  net/ipv4/tcp.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 82bd707c03472f2cebb1a90d5f1c13acc821468f..603e770d59b3db96adca9602319d2f6970a56285 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -872,6 +872,8 @@ struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp,
>                         sk->sk_tx_skb_cache = NULL;
>                         pskb_trim(skb, 0);
>                         INIT_LIST_HEAD(&skb->tcp_tsorted_anchor);
> +                       skb_shinfo(skb)->tx_flags = 0;
> +                       memset(TCP_SKB_CB(skb), 0, sizeof(struct tcp_skb_cb));
>                         return skb;
>                 }
>         }
> --
> 2.21.0.392.gf8f6787159e-goog
>

  reply	other threads:[~2019-03-29 19:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-29 19:46 [PATCH net-next] tcp: cleanup sk_tx_skb_cache before reuse Eric Dumazet
2019-03-29 19:50 ` Soheil Hassas Yeganeh [this message]
2019-03-29 20:17 ` 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=CACSApvbBEfDzsY2NCK2xsCK9t4zY5mMQX14SGrtOG7vumZmufw@mail.gmail.com \
    --to=soheil@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=willemb@google.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).