aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/core.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2013-05-22 22:42:36 +0000
committerPablo Neira Ayuso <pablo@netfilter.org>2013-05-23 14:22:30 +0200
commit6d11cfdba52af08b889fd6d3ee4212930493eb38 (patch)
treea6de2aaf9eb6ca94884faa8e56bc2960fd6c1467 /net/netfilter/core.c
parentbridge: netfilter: using strlcpy() instead of strncpy() (diff)
downloadlinux-dev-6d11cfdba52af08b889fd6d3ee4212930493eb38.tar.xz
linux-dev-6d11cfdba52af08b889fd6d3ee4212930493eb38.zip
netfilter: don't panic on error while walking through the init path
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>
Diffstat (limited to 'net/netfilter/core.c')
-rw-r--r--net/netfilter/core.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 07c865a31a3d..300539db7bb1 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -302,17 +302,26 @@ static struct pernet_operations netfilter_net_ops = {
.exit = netfilter_net_exit,
};
-void __init netfilter_init(void)
+int __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;
}