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)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 11 Nov 2017 13:34:30 +0000 (13:34 +0000)
commit30e9111ccd2919150e4217922e8053f4c1ab20de
tree11b920caef0da724276fe8f1b94b1698a7b67dca
parent5bb5cc4ec4fa756070edf5e851fa9607dbf6d3a8
ipv6: accept 64k - 1 packet length in ip6_find_1stfragopt()

commit 3de33e1ba0506723ab25734e098cf280ecc34756 upstream.

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