Skip to contentSkip to conversation

netfilter: ip6_tables: zero-initialize fragment offset

PATCH Applied Jeremy Sowden 3 participants 4 messages Sep 12, 2021 – Sep 15, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: ip6_tables: zero-initialize fragment offset

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.

---
 net/ipv6/netfilter/ip6_tables.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv6/netfilter/ip6_tables.c +1 -0
index de2cf3943b91..a579ea14a69b 100644
@@ -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;
 
Signature · 1 line
2.33.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jeremy Sowden

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.

Fixes f7108a20dee44 ("netfilter: xtables: move extension arguments into compound structure (1/6)"
#2 lore raw
Quoted 9 lines · Florian Westphal
Quoted 5 lines · Jeremy Sowden

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.

Fixes f7108a20dee44 ("netfilter: xtables: move extension arguments into compound structure (1/6)"

Thanks, Florian.

J.

maintainer Applied
#3 lore raw
In reply to Jeremy Sowden
Quoted 5 lines · Jeremy Sowden

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.

Applied, thanks.