Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>, lirongqing@baidu.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH][net-next] net: slightly optimize eth_type_trans
Date: Sat, 17 Nov 2018 14:37:12 -0800	[thread overview]
Message-ID: <d5201107-08b3-8681-993d-2ba3480707e7@gmail.com> (raw)
In-Reply-To: <20181115.151131.596213640354724307.davem@davemloft.net>



On 11/15/2018 03:11 PM, David Miller wrote:

> 
> Applied.
> 

While reviewing this stuff, I found we have a bug.

If napi_reuse_skb() is called, we might inherit from prior skb->pkt_type value.

It seems that GRO could aggregate packets with pkt_type != PACKET_HOST, right ?

David, any objection if I submit the following fix ?

diff --git a/net/core/dev.c b/net/core/dev.c
index 5927f6a7c301ed90af21a4b82b443f30f00bb483..f2bfd2eda7b2734d29d30f0e82c1a48c1b5b166a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5664,6 +5664,10 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
        __vlan_hwaccel_clear_tag(skb);
        skb->dev = napi->dev;
        skb->skb_iif = 0;
+
+       /* eth_type_trans() assumes initial pkt_type is PACKET_HOST */
+       skb->pkt_type = PACKET_HOST;
+
        skb->encapsulation = 0;
        skb_shinfo(skb)->gso_type = 0;
        skb->truesize = SKB_TRUESIZE(skb_end_offset(skb));

  reply	other threads:[~2018-11-18  8:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-13  1:34 [PATCH][net-next] net: slightly optimize eth_type_trans Li RongQing
2018-11-15 23:11 ` David Miller
2018-11-17 22:37   ` Eric Dumazet [this message]
2018-11-18  0:51     ` David Miller
2018-11-18  1:19       ` Eric Dumazet
2018-11-18  4:06         ` 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=d5201107-08b3-8681-993d-2ba3480707e7@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=lirongqing@baidu.com \
    --cc=netdev@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