]> git.baikalelectronics.ru Git - kernel.git/commitdiff
netfilter: ip6_tables: zero-initialize fragment offset
authorJeremy Sowden <jeremy@azazel.net>
Sun, 12 Sep 2021 21:24:33 +0000 (22:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Oct 2021 08:42:33 +0000 (10:42 +0200)
[ Upstream commit 310e2d43c3ad429c1fba4b175806cf1f55ed73a6 ]

ip6tables only sets the `IP6T_F_PROTO` flag on a rule if a protocol is
specified (`-p tcp`, for example).  However, if the flag is not set,
`ip6_packet_match` doesn't call `ipv6_find_hdr` for the skb, in which
case the fragment offset is left uninitialized and a garbage value is
passed to each matcher.

Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/netfilter/ip6_tables.c

index 8bb543b0e775ef2fa7da2499666f3d46f98e6bf2..41268612bdd4e0ed8f8829580026aa4e39086219 100644 (file)
@@ -273,6 +273,7 @@ ip6t_do_table(struct sk_buff *skb,
         * things we don't know, ie. tcp syn flag or ports).  If the
         * rule is also a fragment-specific rule, non-fragments won't
         * match it. */
+       acpar.fragoff = 0;
        acpar.hotdrop = false;
        acpar.state   = state;