]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: fix out-of-bound access in ip6_parse_tlv()
authorEric Dumazet <edumazet@google.com>
Thu, 24 Jun 2021 10:07:20 +0000 (03:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jul 2021 14:53:33 +0000 (16:53 +0200)
commitf3974913c3882be28afd50e485acb83ee2d8e07d
tree4ef55cacc2aaed959376b61d1f8439d54df991b9
parent79df52ee3128cab088c0f3aed9c7f5d3269ab772
ipv6: fix out-of-bound access in ip6_parse_tlv()

[ Upstream commit 624085a31c1ad6a80b1e53f686bf6ee92abbf6e8 ]

First problem is that optlen is fetched without checking
there is more than one byte to parse.

Fix this by taking care of IPV6_TLV_PAD1 before
fetching optlen (under appropriate sanity checks against len)

Second problem is that IPV6_TLV_PADN checks of zero
padding are performed before the check of remaining length.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Fixes: 8094d0b3dff2 ("net/ipv6/exthdrs.c: Strict PadN option checking")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/exthdrs.c