netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gao feng <gaofeng@cn.fujitsu.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/3] netfilter: don't panic on error while walking through the init path
Date: Thu, 23 May 2013 16:50:48 +0800	[thread overview]
Message-ID: <519DD868.1070809@cn.fujitsu.com> (raw)
In-Reply-To: <1369298557-5351-2-git-send-email-pablo@netfilter.org>

On 05/23/2013 04:42 PM, Pablo Neira Ayuso wrote:
> Don't panic if we hit an error while adding the nf_log or pernet
> netfilter support, just bail out.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> ---

Acked-by: Gao feng <gaofeng@cn.fujitsu.com>

>  net/netfilter/core.c   |   19 ++++++++++++++-----
>  net/netfilter/nf_log.c |    5 +----
>  2 files changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/net/netfilter/core.c b/net/netfilter/core.c
> index 07c865a..3905104 100644
> --- a/net/netfilter/core.c
> +++ b/net/netfilter/core.c
> @@ -304,15 +304,24 @@ static struct pernet_operations netfilter_net_ops = {
>  
>  void __init netfilter_init(void)
>  {
> -	int i, h;
> +	int i, h, ret;
> +
>  	for (i = 0; i < ARRAY_SIZE(nf_hooks); i++) {
>  		for (h = 0; h < NF_MAX_HOOKS; h++)
>  			INIT_LIST_HEAD(&nf_hooks[i][h]);
>  	}
>  
> -	if (register_pernet_subsys(&netfilter_net_ops) < 0)
> -		panic("cannot create netfilter proc entry");
> +	ret = register_pernet_subsys(&netfilter_net_ops);
> +	if (ret < 0)
> +		goto err;
> +
> +	ret = netfilter_log_init();
> +	if (ret < 0)
> +		goto err_pernet;
>  
> -	if (netfilter_log_init() < 0)
> -		panic("cannot initialize nf_log");
> +	return 0;
> +err_pernet:
> +	unregister_pernet_subsys(&netfilter_net_ops);
> +err:
> +	return ret;
>  }
> diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c
> index 388656d..bd5474a 100644
> --- a/net/netfilter/nf_log.c
> +++ b/net/netfilter/nf_log.c
> @@ -368,10 +368,7 @@ static int __net_init nf_log_net_init(struct net *net)
>  	return 0;
>  
>  out_sysctl:
> -	/* For init_net: errors will trigger panic, don't unroll on error. */
> -	if (!net_eq(net, &init_net))
> -		remove_proc_entry("nf_log", net->nf.proc_netfilter);
> -
> +	remove_proc_entry("nf_log", net->nf.proc_netfilter);
>  	return ret;
>  }
>  
> 


  reply	other threads:[~2013-05-23  8:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23  8:42 [PATCH 1/3] netfilter: ctnetlink: attach expectations to unconfirmed conntracks Pablo Neira Ayuso
2013-05-23  8:42 ` [PATCH 2/3] netfilter: don't panic on error while walking through the init path Pablo Neira Ayuso
2013-05-23  8:50   ` Gao feng [this message]
2013-05-23 11:09     ` Pablo Neira Ayuso
2013-05-23  8:42 ` [PATCH 3/3] netfilter: {ipt,ebt}_ULOG: rise warning on deprecation Pablo Neira Ayuso
2013-05-23  8:59   ` Gao feng
2013-05-23 11:09     ` Pablo Neira Ayuso
2013-05-23  9:34 ` [PATCH 1/3] netfilter: ctnetlink: attach expectations to unconfirmed conntracks Gao feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=519DD868.1070809@cn.fujitsu.com \
    --to=gaofeng@cn.fujitsu.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).