diff --git a/net/netfilter/core.c b/net/netfilter/core.c index ef4e76e5aef9..393c2c432916 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -473,10 +473,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, %s, %d\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 +517,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); }