Skip to content

Commit 8aae762

Browse files
Florian WestphalPaolo Abeni
authored andcommitted
net: fib: avoid warn splat in flow dissector
New skbs allocated via nf_send_reset() have skb->dev == NULL. fib*_rules_early_flow_dissect helpers already have a 'struct net' argument but its not passed down to the flow dissector core, which will then WARN as it can't derive a net namespace to use: WARNING: CPU: 0 PID: 0 at net/core/flow_dissector.c:1016 __skb_flow_dissect+0xa91/0x1cd0 [..] ip_route_me_harder+0x143/0x330 nf_send_reset+0x17c/0x2d0 [nf_reject_ipv4] nft_reject_inet_eval+0xa9/0xf2 [nft_reject_inet] nft_do_chain+0x198/0x5d0 [nf_tables] nft_do_chain_inet+0xa4/0x110 [nf_tables] nf_hook_slow+0x41/0xc0 ip_local_deliver+0xce/0x110 .. Cc: Stanislav Fomichev <[email protected]> Cc: David Ahern <[email protected]> Cc: Ido Schimmel <[email protected]> Fixes: 812fa71 ("netfilter: Dissect flow after packet mangling") Link: https://bugzilla.kernel.org/show_bug.cgi?id=217826 Signed-off-by: Florian Westphal <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Reviewed-by: David Ahern <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent a3e0fdf commit 8aae762

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

include/net/ip6_fib.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,10 @@ static inline bool fib6_rules_early_flow_dissect(struct net *net,
642642
if (!net->ipv6.fib6_rules_require_fldissect)
643643
return false;
644644

645-
skb_flow_dissect_flow_keys(skb, flkeys, flag);
645+
memset(flkeys, 0, sizeof(*flkeys));
646+
__skb_flow_dissect(net, skb, &flow_keys_dissector,
647+
flkeys, NULL, 0, 0, 0, flag);
648+
646649
fl6->fl6_sport = flkeys->ports.src;
647650
fl6->fl6_dport = flkeys->ports.dst;
648651
fl6->flowi6_proto = flkeys->basic.ip_proto;

include/net/ip_fib.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,10 @@ static inline bool fib4_rules_early_flow_dissect(struct net *net,
418418
if (!net->ipv4.fib_rules_require_fldissect)
419419
return false;
420420

421-
skb_flow_dissect_flow_keys(skb, flkeys, flag);
421+
memset(flkeys, 0, sizeof(*flkeys));
422+
__skb_flow_dissect(net, skb, &flow_keys_dissector,
423+
flkeys, NULL, 0, 0, 0, flag);
424+
422425
fl4->fl4_sport = flkeys->ports.src;
423426
fl4->fl4_dport = flkeys->ports.dst;
424427
fl4->flowi4_proto = flkeys->basic.ip_proto;

0 commit comments

Comments
 (0)