ip_tunnel: fix kernel panic with icmp_dest_unreach
authorEric Dumazet <edumazet@google.com>
Fri, 24 May 2013 05:49:58 +0000 (05:49 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 29 Jun 2013 03:06:38 +0000 (04:06 +0100)
commit94e7239c1bacb37ccddc3b32f3050780cab9d3d7
tree2a0fc8bec2b8d4b0eece8412b63719b9d8eafb04
parentbe25f0fd74914963cd2b0ee8e4eefb1f596f0b05
ip_tunnel: fix kernel panic with icmp_dest_unreach

[ Upstream commit a622260254ee481747cceaaa8609985b29a31565 ]

Daniel Petre reported crashes in icmp_dst_unreach() with following call
graph:

Daniel found a similar problem mentioned in
 http://lkml.indiana.edu/hypermail/linux/kernel/1007.0/00961.html

And indeed this is the root cause : skb->cb[] contains data fooling IP
stack.

We must clear IPCB in ip_tunnel_xmit() sooner in case dst_link_failure()
is called. Or else skb->cb[] might contain garbage from GSO segmentation
layer.

A similar fix was tested on linux-3.9, but gre code was refactored in
linux-3.10. I'll send patches for stable kernels as well.

Many thanks to Daniel for providing reports, patches and testing !

Reported-by: Daniel Petre <daniel.petre@rcs-rds.ro>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv4/ip_gre.c
net/ipv4/ipip.c