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)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 26 Aug 2017 01:14:05 +0000 (02:14 +0100)
commitc5a5d1b1cb8449c77d3cb1663649391635228cff
treed9c9f1d34dc502a12cf23844aad35a998db13d4f
parent408ab21ebbf0c95946502005327a173a475c025c
ipv6: avoid overflow of offset in ip6_find_1stfragopt

commit 6399f1fae4ec29fab5ec76070435555e256ca3a6 upstream.

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>
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/ipv6/ip6_output.c