netfilter: decnet: only register hooks in init namespace
authorFlorian Westphal <fw@strlen.de>
Wed, 19 Apr 2017 22:42:07 +0000 (00:42 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 26 Apr 2017 07:30:21 +0000 (09:30 +0200)
looks like decnet isn't namespacified in first place, so restrict hook
registration to the initial namespace.

Prepares for eventual removal of legacy nf_register_hook() api.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/decnet/netfilter/dn_rtmsg.c

index 85f2fdc360c27b21cb5b9c486e2d05ffb1d557d7..f44303a401056c58767e20446ac0fa820d43f33e 100644 (file)
@@ -134,7 +134,7 @@ static int __init dn_rtmsg_init(void)
                return -ENOMEM;
        }
 
-       rv = nf_register_hook(&dnrmg_ops);
+       rv = nf_register_net_hook(&init_net, &dnrmg_ops);
        if (rv) {
                netlink_kernel_release(dnrmg);
        }
@@ -144,7 +144,7 @@ static int __init dn_rtmsg_init(void)
 
 static void __exit dn_rtmsg_fini(void)
 {
-       nf_unregister_hook(&dnrmg_ops);
+       nf_unregister_net_hook(&init_net, &dnrmg_ops);
        netlink_kernel_release(dnrmg);
 }