[PATCH 3.16 200/306] ip6_tunnel: Clear IP6CB in ip6tunnel_xmit()

From: Ben Hutchings
Date: Wed Feb 15 2017 - 18:10:04 EST


3.16.40-rc1 review patch. If anyone has any objections, please let me know.

------------------

From: Eli Cooper <elicooper@xxxxxxx>

commit 23f4ffedb7d751c7e298732ba91ca75d224bc1a6 upstream.

skb->cb may contain data from previous layers. In the observed scenario,
the garbage data were misinterpreted as IP6CB(skb)->frag_max_size, so
that small packets sent through the tunnel are mistakenly fragmented.

This patch unconditionally clears the control buffer in ip6tunnel_xmit(),
which affects ip6_tunnel, ip6_udp_tunnel and ip6_gre. Currently none of
these tunnels set IP6CB(skb)->flags, otherwise it needs to be done earlier.

Signed-off-by: Eli Cooper <elicooper@xxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
include/net/ip6_tunnel.h | 1 +
1 file changed, 1 insertion(+)

--- a/include/net/ip6_tunnel.h
+++ b/include/net/ip6_tunnel.h
@@ -75,6 +75,7 @@ static inline void ip6tunnel_xmit(struct
struct net_device_stats *stats = &dev->stats;
int pkt_len, err;

+ memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
pkt_len = skb->len;
err = ip6_local_out(skb);