diff --git a/net/netfilter/core.c b/net/netfilter/core.c index 3f0bdc728f891f8f277bad9236fb345fe427cbb1..ada3163b3fa3be1a5929156abb756144c4783532 100644 --- a/net/netfilter/core.c +++ b/net/netfilter/core.c @@ -335,14 +335,15 @@ static int __nf_register_net_hook(struct net *net, int pf, p = nf_entry_dereference(*pp); new_hooks = nf_hook_entries_grow(p, reg); - if (!IS_ERR(new_hooks)) + if (!IS_ERR(new_hooks)) { + hooks_validate(new_hooks); rcu_assign_pointer(*pp, new_hooks); + } mutex_unlock(&nf_hook_mutex); if (IS_ERR(new_hooks)) return PTR_ERR(new_hooks); - hooks_validate(new_hooks); #ifdef CONFIG_NETFILTER_INGRESS if (pf == NFPROTO_NETDEV && reg->hooknum == NF_NETDEV_INGRESS) net_inc_ingress_queue();