summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-01-09 20:32:19 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-01-09 23:25:48 +0100
commitcf4dfa85395ebe2769267a072b39e48301669842 (patch)
tree92978b3f3a0088763a7a683166c1b25c8883cea2 /net
parent3876d22dba62ebf6582f33e1ef2160eeb95e1129 (diff)
downloadlinux-stable-cf4dfa85395ebe2769267a072b39e48301669842.tar.gz
linux-stable-cf4dfa85395ebe2769267a072b39e48301669842.tar.bz2
linux-stable-cf4dfa85395ebe2769267a072b39e48301669842.zip
netfilter: nf_tables: fix error path in the init functions
We have to unregister chain type if this fails to register netns. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/netfilter/nf_tables_ipv4.c8
-rw-r--r--net/ipv6/netfilter/nf_tables_ipv6.c8
-rw-r--r--net/netfilter/nf_tables_inet.c8
3 files changed, 21 insertions, 3 deletions
diff --git a/net/ipv4/netfilter/nf_tables_ipv4.c b/net/ipv4/netfilter/nf_tables_ipv4.c
index fec163a6ac38..6820c8c40842 100644
--- a/net/ipv4/netfilter/nf_tables_ipv4.c
+++ b/net/ipv4/netfilter/nf_tables_ipv4.c
@@ -105,8 +105,14 @@ static const struct nf_chain_type filter_ipv4 = {
static int __init nf_tables_ipv4_init(void)
{
+ int ret;
+
nft_register_chain_type(&filter_ipv4);
- return register_pernet_subsys(&nf_tables_ipv4_net_ops);
+ ret = register_pernet_subsys(&nf_tables_ipv4_net_ops);
+ if (ret < 0)
+ nft_unregister_chain_type(&filter_ipv4);
+
+ return ret;
}
static void __exit nf_tables_ipv4_exit(void)
diff --git a/net/ipv6/netfilter/nf_tables_ipv6.c b/net/ipv6/netfilter/nf_tables_ipv6.c
index 59a43b474dca..0d812b31277d 100644
--- a/net/ipv6/netfilter/nf_tables_ipv6.c
+++ b/net/ipv6/netfilter/nf_tables_ipv6.c
@@ -104,8 +104,14 @@ static const struct nf_chain_type filter_ipv6 = {
static int __init nf_tables_ipv6_init(void)
{
+ int ret;
+
nft_register_chain_type(&filter_ipv6);
- return register_pernet_subsys(&nf_tables_ipv6_net_ops);
+ ret = register_pernet_subsys(&nf_tables_ipv6_net_ops);
+ if (ret < 0)
+ nft_unregister_chain_type(&filter_ipv6);
+
+ return ret;
}
static void __exit nf_tables_ipv6_exit(void)
diff --git a/net/netfilter/nf_tables_inet.c b/net/netfilter/nf_tables_inet.c
index 84478de179ea..9dd2d216cfc1 100644
--- a/net/netfilter/nf_tables_inet.c
+++ b/net/netfilter/nf_tables_inet.c
@@ -80,8 +80,14 @@ static const struct nf_chain_type filter_inet = {
static int __init nf_tables_inet_init(void)
{
+ int ret;
+
nft_register_chain_type(&filter_inet);
- return register_pernet_subsys(&nf_tables_inet_net_ops);
+ ret = register_pernet_subsys(&nf_tables_inet_net_ops);
+ if (ret < 0)
+ nft_unregister_chain_type(&filter_inet);
+
+ return ret;
}
static void __exit nf_tables_inet_exit(void)