diff --git a/net/netfilter/core.c b/net/netfilter/core.c index ef4e76e5aef9..f61233ad6ef5 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -279,6 +279,14 @@ static struct nf_hook_entries __rcu ** nf_hook_entry_head(struct net *net, int pf, unsigned int hooknum, struct net_device *dev) { + printk("%d, %d, %d, %d, %d, %d, %d, %d, %s\n", pf, + ARRAY_SIZE(net->nf.hooks_arp), + ARRAY_SIZE(net->nf.hooks_bridge), + NF_INET_INGRESS, + ARRAY_SIZE(net->nf.hooks_ipv4), + ARRAY_SIZE(net->nf.hooks_ipv6), + NF_NETDEV_EGRESS, + hooknum, __func__); switch (pf) { case NFPROTO_NETDEV: break; @@ -473,10 +481,13 @@ static bool nf_remove_net_hook(struct nf_hook_entries *old, struct nf_hook_ops **orig_ops; unsigned int i; + printk("%d, %p, %p, %d, %s\n", IS_ERR(old), old, unreg, old->num_hook_entries, __func__); orig_ops = nf_hook_entries_get_hook_ops(old); for (i = 0; i < old->num_hook_entries; i++) { - if (orig_ops[i] != unreg) + if (orig_ops[i] != unreg) { + printk("%p, %d, %s\n", orig_ops[i], i, __func__); continue; + } WRITE_ONCE(old->hooks[i].hook, accept_all); WRITE_ONCE(orig_ops[i], (void *)&dummy_ops); return true; @@ -514,6 +525,8 @@ static void __nf_unregister_net_hook(struct net *net, int pf, #endif nf_static_key_dec(reg, pf); } else { + if (IS_ERR(p)) + return; WARN_ONCE(1, "hook not found, pf %d num %d", pf, reg->hooknum); }