OSDN Git Service

ipv6: fix possible use-after-free in ip6_xmit()
authorEric Dumazet <edumazet@google.com>
Fri, 14 Sep 2018 19:02:31 +0000 (12:02 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 29 Sep 2018 10:07:32 +0000 (03:07 -0700)
commit76b338069f0dbf33ac7a66f167a804b9dcc96b58
tree4edf4b7f6eaeec1420f8f19b0bd7c8e00d9b2f8a
parent2b797b65d8d9f1fc751e8bb3ef7a576f95895bda
ipv6: fix possible use-after-free in ip6_xmit()

[ Upstream commit bbd6528d28c1b8e80832b3b018ec402b6f5c3215 ]

In the unlikely case ip6_xmit() has to call skb_realloc_headroom(),
we need to call skb_set_owner_w() before consuming original skb,
otherwise we risk a use-after-free.

Bring IPv6 in line with what we do in IPv4 to fix this.

Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ip6_output.c