ipv6: fix ip6_tnl_parse_tlv_enc_lim()
authorEric Dumazet <edumazet@google.com>
Tue, 24 Jan 2017 00:43:06 +0000 (16:43 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:56 +0000 (02:18 +0000)
commita6f6bb6bc04a5f88a31f47a6123d3fbf5ee8d694
tree1a88190a61b31f980146951f01808bf130b9a905
parent47c192ef34576d3f88451f40b960713f94c3b22f
ipv6: fix ip6_tnl_parse_tlv_enc_lim()

[ Upstream commit fbfa743a9d2a0ffa24251764f10afc13eb21e739 ]

This function suffers from multiple issues.

First one is that pskb_may_pull() may reallocate skb->head,
so the 'raw' pointer needs either to be reloaded or not used at all.

Second issue is that NEXTHDR_DEST handling does not validate
that the options are present in skb->data, so we might read
garbage or access non existent memory.

With help from Willem de Bruijn.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv6/ip6_tunnel.c