* [PATCH net] gro: Disable frag0 optimization on IPv6 ext headers
@ 2017-01-10 20:24 Eric Dumazet
2017-01-11 2:31 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2017-01-10 20:24 UTC (permalink / raw)
To: David Miller
Cc: netdev, Herbert Xu, Slava Shwartsman, Willem de Bruijn,
Eric Dumazet
From: Herbert Xu <herbert@gondor.apana.org.au>
The GRO fast path caches the frag0 address. This address becomes
invalid if frag0 is modified by pskb_may_pull or its variants.
So whenever that happens we must disable the frag0 optimization.
This is usually done through the combination of gro_header_hard
and gro_header_slow, however, the IPv6 extension header path did
the pulling directly and would continue to use the GRO fast path
incorrectly.
This patch fixes it by disabling the fast path when we enter the
IPv6 extension header path.
Fixes: 78a478d0efd9 ("gro: Inline skb_gro_header and cache frag0 virtual address")
Reported-by: Slava Shwartsman <slavash@mellanox.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
include/linux/netdevice.h | 9 +++++++--
net/ipv6/ip6_offload.c | 1 +
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 994f7423a74bd622884c3b646f4123d28697b8ad..9bde9558b59672a866bd763039d326bde2af0f81 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2477,14 +2477,19 @@ static inline int skb_gro_header_hard(struct sk_buff *skb, unsigned int hlen)
return NAPI_GRO_CB(skb)->frag0_len < hlen;
}
+static inline void skb_gro_frag0_invalidate(struct sk_buff *skb)
+{
+ NAPI_GRO_CB(skb)->frag0 = NULL;
+ NAPI_GRO_CB(skb)->frag0_len = 0;
+}
+
static inline void *skb_gro_header_slow(struct sk_buff *skb, unsigned int hlen,
unsigned int offset)
{
if (!pskb_may_pull(skb, hlen))
return NULL;
- NAPI_GRO_CB(skb)->frag0 = NULL;
- NAPI_GRO_CB(skb)->frag0_len = 0;
+ skb_gro_frag0_invalidate(skb);
return skb->data + offset;
}
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index 89c59e656f44939863ceada610d3442d2de666ba..fc7b4017ba241f9dd39d49bd6258ecd4a16e3a3a 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -191,6 +191,7 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
ops = rcu_dereference(inet6_offloads[proto]);
if (!ops || !ops->callbacks.gro_receive) {
__pskb_pull(skb, skb_gro_offset(skb));
+ skb_gro_frag0_invalidate(skb);
proto = ipv6_gso_pull_exthdrs(skb, proto);
skb_gro_pull(skb, -skb_transport_offset(skb));
skb_reset_transport_header(skb);
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] gro: Disable frag0 optimization on IPv6 ext headers
2017-01-10 20:24 [PATCH net] gro: Disable frag0 optimization on IPv6 ext headers Eric Dumazet
@ 2017-01-11 2:31 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-01-11 2:31 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, herbert, slavash, willemb, edumazet
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 10 Jan 2017 12:24:15 -0800
> From: Herbert Xu <herbert@gondor.apana.org.au>
>
> The GRO fast path caches the frag0 address. This address becomes
> invalid if frag0 is modified by pskb_may_pull or its variants.
> So whenever that happens we must disable the frag0 optimization.
>
> This is usually done through the combination of gro_header_hard
> and gro_header_slow, however, the IPv6 extension header path did
> the pulling directly and would continue to use the GRO fast path
> incorrectly.
>
> This patch fixes it by disabling the fast path when we enter the
> IPv6 extension header path.
>
> Fixes: 78a478d0efd9 ("gro: Inline skb_gro_header and cache frag0 virtual address")
> Reported-by: Slava Shwartsman <slavash@mellanox.com>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-11 2:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-10 20:24 [PATCH net] gro: Disable frag0 optimization on IPv6 ext headers Eric Dumazet
2017-01-11 2:31 ` David Miller
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).