ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()
authorStefano Brivio <sbrivio@redhat.com>
Fri, 18 Aug 2017 12:40:53 +0000 (14:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Sep 2017 06:19:52 +0000 (08:19 +0200)
commitdccb31be7ef8984b8fa636b65f74b662db6b3cb3
treeb21742b0fd9d25ece1ef3c0806a2e172df4d6231
parent4ad5dcaca7428dd2bc1a6a40c948e3799c1e27ae
ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()

[ Upstream commit 3de33e1ba0506723ab25734e098cf280ecc34756 ]

A packet length of exactly IPV6_MAXPLEN is allowed, we should
refuse parsing options only if the size is 64KiB or more.

While at it, remove one extra variable and one assignment which
were also introduced by the commit that introduced the size
check. Checking the sum 'offset + len' and only later adding
'len' to 'offset' doesn't provide any advantage over directly
summing to 'offset' and checking it.

Fixes: 6399f1fae4ec ("ipv6: avoid overflow of offset in ip6_find_1stfragopt")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/output_core.c