Commit 86347245 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv6: gro: fix PV6_GRO_CB(skb)->proto problem

It seems IPV6_GRO_CB(skb)->proto can be destroyed in skb_gro_receive()
if a new skb is allocated (to serve as an anchor for frag_list)

We copy NAPI_GRO_CB() only (not the IPV6 specific part) in :

*NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p);

So we leave IPV6_GRO_CB(nskb)->proto to 0 (fresh skb allocation) instead
of IPPROTO_TCP (6)

ipv6_gro_complete() isnt able to call ops->gro_complete()
[ tcp6_gro_complete() ]

Fix this by moving proto in NAPI_GRO_CB() and getting rid of
IPV6_GRO_CB
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 48cc32d3
...@@ -1513,6 +1513,9 @@ struct napi_gro_cb { ...@@ -1513,6 +1513,9 @@ struct napi_gro_cb {
/* jiffies when first packet was created/queued */ /* jiffies when first packet was created/queued */
unsigned long age; unsigned long age;
/* Used in ipv6_gro_receive() */
int proto;
}; };
#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) #define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
......
...@@ -822,13 +822,6 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, ...@@ -822,13 +822,6 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
return segs; return segs;
} }
struct ipv6_gro_cb {
struct napi_gro_cb napi;
int proto;
};
#define IPV6_GRO_CB(skb) ((struct ipv6_gro_cb *)(skb)->cb)
static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
struct sk_buff *skb) struct sk_buff *skb)
{ {
...@@ -874,7 +867,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, ...@@ -874,7 +867,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
iph = ipv6_hdr(skb); iph = ipv6_hdr(skb);
} }
IPV6_GRO_CB(skb)->proto = proto; NAPI_GRO_CB(skb)->proto = proto;
flush--; flush--;
nlen = skb_network_header_len(skb); nlen = skb_network_header_len(skb);
...@@ -930,7 +923,7 @@ static int ipv6_gro_complete(struct sk_buff *skb) ...@@ -930,7 +923,7 @@ static int ipv6_gro_complete(struct sk_buff *skb)
sizeof(*iph)); sizeof(*iph));
rcu_read_lock(); rcu_read_lock();
ops = rcu_dereference(inet6_protos[IPV6_GRO_CB(skb)->proto]); ops = rcu_dereference(inet6_protos[NAPI_GRO_CB(skb)->proto]);
if (WARN_ON(!ops || !ops->gro_complete)) if (WARN_ON(!ops || !ops->gro_complete))
goto out_unlock; goto out_unlock;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment