ip6_tunnel: fix possible use-after-free on xmit
authorHaishuang Yan <yanhaishuang@cmss.chinamobile.com>
Thu, 25 Jul 2019 16:40:17 +0000 (00:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 11 Aug 2019 10:22:17 +0000 (12:22 +0200)
commitdfb98836f9a3feb4be8128521d1f4809814b092c
tree1a270a7fd0526b3b51e90a2c66e74654e99f0d0a
parent00a8794f636b83eec31eee0d4ab27923b48506d8
ip6_tunnel: fix possible use-after-free on xmit

[ Upstream commit 01f5bffad555f8e22a61f4b1261fe09cf1b96994 ]

ip4ip6/ip6ip6 tunnels run iptunnel_handle_offloads on xmit which
can cause a possible use-after-free accessing iph/ipv6h pointer
since the packet will be 'uncloned' running pskb_expand_head if
it is a cloned gso skb.

Fixes: 0e9a709560db ("ip6_tunnel, ip6_gre: fix setting of DSCP on encapsulated packets")
Signed-off-by: Haishuang Yan <yanhaishuang@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ip6_tunnel.c