]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
net-gro: reset skb->pkt_type in napi_reuse_skb()
authorEric Dumazet <edumazet@google.com>
Sun, 18 Nov 2018 05:57:02 +0000 (21:57 -0800)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:59:49 +0000 (19:59 -0600)
BugLink: https://bugs.launchpad.net/bugs/1836968
[ Upstream commit 33d9a2c72f086cbf1087b2fd2d1a15aa9df14a7f ]

eth_type_trans() assumes initial value for skb->pkt_type
is PACKET_HOST.

This is indeed the value right after a fresh skb allocation.

However, it is possible that GRO merged a packet with a different
value (like PACKET_OTHERHOST in case macvlan is used), so
we need to make sure napi->skb will have pkt_type set back to
PACKET_HOST.

Otherwise, valid packets might be dropped by the stack because
their pkt_type is not PACKET_HOST.

napi_reuse_skb() was added in commit 96e93eab2033 ("gro: Add
internal interfaces for VLAN"), but this bug always has
been there.

Fixes: 96e93eab2033 ("gro: Add internal interfaces for VLAN")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/core/dev.c

index 07a9e0be129f3c3fab96962ccbcaab5a50be084a..e4dddd196b84b4d545336f203db01adc28a32549 100644 (file)
@@ -5065,6 +5065,10 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
        skb->vlan_tci = 0;
        skb->dev = napi->dev;
        skb->skb_iif = 0;
+
+       /* eth_type_trans() assumes 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));