ipv6: gre: correct calculation of max_headroom
authorHannes Frederic Sowa <hannes@stressinduktion.org>
Sun, 29 Sep 2013 03:40:50 +0000 (05:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 13 Oct 2013 23:08:30 +0000 (16:08 -0700)
commit102ce961c8d54d613eb49d6bc71ecec674505815
treee7f6efe877f1477b8e81878dd06ba2f3f1880407
parentc9b391f6d166118c5543e9d1708e67977dbdbe1f
ipv6: gre: correct calculation of max_headroom

[ Upstream commit 3da812d860755925da890e8c713f2d2e2d7b1bae ]

gre_hlen already accounts for sizeof(struct ipv6_hdr) + gre header,
so initialize max_headroom to zero. Otherwise the

if (encap_limit >= 0) {
max_headroom += 8;
mtu -= 8;
}

increments an uninitialized variable before max_headroom was reset.

Found with coverity: 728539

Cc: Dmitry Kozlov <xeb@mail.ru>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ip6_gre.c