[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1544392233.158413680@decadent.org.uk>
Date: Sun, 09 Dec 2018 21:50:33 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Florian Westphal" <fw@...len.de>,
"Pablo Neira Ayuso" <pablo@...filter.org>
Subject: [PATCH 3.16 145/328] netfilter: nf_tables: fix register ordering
3.16.62-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <fw@...len.de>
commit d209df3e7f7002d9099fdb0f6df0f972b4386a63 upstream.
We must register nfnetlink ops last, as that exposes nf_tables to
userspace. Without this, we could theoretically get nfnetlink request
before net->nft state has been initialized.
Fixes: 99633ab29b213 ("netfilter: nf_tables: complete net namespace support")
Signed-off-by: Florian Westphal <fw@...len.de>
Signed-off-by: Pablo Neira Ayuso <pablo@...filter.org>
[bwh: Backported to 3.16:
- We don't call nft_chain_filter_{init,fini}() or
{,un}register_netdevice_notifier()
- Adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -4042,6 +4042,10 @@ static int __init nf_tables_module_init(
{
int err;
+ err = register_pernet_subsys(&nf_tables_net_ops);
+ if (err < 0)
+ return err;
+
info = kmalloc(sizeof(struct nft_expr_info) * NFT_RULE_MAXEXPRS,
GFP_KERNEL);
if (info == NULL) {
@@ -4053,17 +4057,19 @@ static int __init nf_tables_module_init(
if (err < 0)
goto err2;
+ /* must be last */
err = nfnetlink_subsys_register(&nf_tables_subsys);
if (err < 0)
goto err3;
pr_info("nf_tables: (c) 2007-2009 Patrick McHardy <kaber@...sh.net>\n");
- return register_pernet_subsys(&nf_tables_net_ops);
+ return err;
err3:
nf_tables_core_module_exit();
err2:
kfree(info);
err1:
+ unregister_pernet_subsys(&nf_tables_net_ops);
return err;
}
Powered by blists - more mailing lists