Skip to content

Commit 43016d0

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: arptables: use pernet ops struct during unregister
Like with iptables and ebtables, hook unregistration has to use the pernet ops struct, not the template. This triggered following splat: hook not found, pf 3 num 0 WARNING: CPU: 0 PID: 224 at net/netfilter/core.c:480 __nf_unregister_net_hook+0x1eb/0x610 net/netfilter/core.c:480 [..] nf_unregister_net_hook net/netfilter/core.c:502 [inline] nf_unregister_net_hooks+0x117/0x160 net/netfilter/core.c:576 arpt_unregister_table_pre_exit+0x67/0x80 net/ipv4/netfilter/arp_tables.c:1565 Fixes: f9006ac ("netfilter: arp_tables: pass table pointer via nf_hook_ops") Reported-by: [email protected] Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent c7d1335 commit 43016d0

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

include/linux/netfilter_arp/arp_tables.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ int arpt_register_table(struct net *net, const struct xt_table *table,
5353
const struct arpt_replace *repl,
5454
const struct nf_hook_ops *ops);
5555
void arpt_unregister_table(struct net *net, const char *name);
56-
void arpt_unregister_table_pre_exit(struct net *net, const char *name,
57-
const struct nf_hook_ops *ops);
56+
void arpt_unregister_table_pre_exit(struct net *net, const char *name);
5857
extern unsigned int arpt_do_table(struct sk_buff *skb,
5958
const struct nf_hook_state *state,
6059
struct xt_table *table);

net/ipv4/netfilter/arp_tables.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,13 +1556,12 @@ int arpt_register_table(struct net *net,
15561556
return ret;
15571557
}
15581558

1559-
void arpt_unregister_table_pre_exit(struct net *net, const char *name,
1560-
const struct nf_hook_ops *ops)
1559+
void arpt_unregister_table_pre_exit(struct net *net, const char *name)
15611560
{
15621561
struct xt_table *table = xt_find_table(net, NFPROTO_ARP, name);
15631562

15641563
if (table)
1565-
nf_unregister_net_hooks(net, ops, hweight32(table->valid_hooks));
1564+
nf_unregister_net_hooks(net, table->ops, hweight32(table->valid_hooks));
15661565
}
15671566
EXPORT_SYMBOL(arpt_unregister_table_pre_exit);
15681567

net/ipv4/netfilter/arptable_filter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int __net_init arptable_filter_table_init(struct net *net)
5454

5555
static void __net_exit arptable_filter_net_pre_exit(struct net *net)
5656
{
57-
arpt_unregister_table_pre_exit(net, "filter", arpfilter_ops);
57+
arpt_unregister_table_pre_exit(net, "filter");
5858
}
5959

6060
static void __net_exit arptable_filter_net_exit(struct net *net)

0 commit comments

Comments
 (0)