Giuseppe Scrivano <gscri...@redhat.com> wrote:
> SELinux, if enabled, registers for each new network namespace 6
> netfilter hooks.  Avoid to use synchronize_net for each new hook, but do
> it once after all the hooks are added.  The net benefit on an SMP
> machine with two cores is that creating a new network namespace takes
> -40% of the original time.
> 
> Signed-off-by: Giuseppe Scrivano <gscri...@redhat.com>
> ---
>  net/netfilter/core.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index 52cd2901a097..beeb0b36f429 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -252,7 +252,7 @@ static struct nf_hook_entries __rcu 
> **nf_hook_entry_head(struct net *net, const
>       return NULL;
>  }
>  
> -int nf_register_net_hook(struct net *net, const struct nf_hook_ops *reg)
> +static int __nf_register_net_hook(struct net *net, const struct nf_hook_ops 
> *reg)
>  {
>       struct nf_hook_entries *p, *new_hooks;
>       struct nf_hook_entries __rcu **pp;
> @@ -291,11 +291,19 @@ int nf_register_net_hook(struct net *net, const struct 
> nf_hook_ops *reg)
>  #ifdef HAVE_JUMP_LABEL
>       static_key_slow_inc(&nf_hooks_needed[reg->pf][reg->hooknum]);
>  #endif
> -     synchronize_net();
>       BUG_ON(p == new_hooks);
>       kvfree(p);

This adds use after free?
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to