ipv6: avoid overflow of offset in ip6_find_1stfragopt
authorSabrina Dubroca <sd@queasysnail.net>
Wed, 19 Jul 2017 20:28:55 +0000 (22:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2017 15:49:32 +0000 (08:49 -0700)
commit4a2ffe1707e3787f93a7d0ff2dec682a57ba25ad
treeff455b754a239a20b7d0d52feb2637ab977c95ef
parent0b83249a57adc1afd19c7e4818731d61d3a8ce7e
ipv6: avoid overflow of offset in ip6_find_1stfragopt

[ Upstream commit 6399f1fae4ec29fab5ec76070435555e256ca3a6 ]

In some cases, offset can overflow and can cause an infinite loop in
ip6_find_1stfragopt(). Make it unsigned int to prevent the overflow, and
cap it at IPV6_MAXPLEN, since packets larger than that should be invalid.

This problem has been here since before the beginning of git history.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/output_core.c