Commit 2ed6afde authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Eric W. Biederman

netns: move {inc,dec}_net_namespaces into #ifdef

With the newly enforced limit on the number of namespaces,
we get a build warning if CONFIG_NETNS is disabled:

net/core/net_namespace.c:273:13: error: 'dec_net_namespaces' defined but not used [-Werror=unused-function]
net/core/net_namespace.c:268:24: error: 'inc_net_namespaces' defined but not used [-Werror=unused-function]

This moves the two added functions inside the #ifdef that guards
their callers.

Fixes: 70328660 ("netns: Add a limit on the number of net namespaces")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 213b067c
...@@ -266,16 +266,6 @@ struct net *get_net_ns_by_id(struct net *net, int id) ...@@ -266,16 +266,6 @@ struct net *get_net_ns_by_id(struct net *net, int id)
return peer; return peer;
} }
static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
{
return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
}
static void dec_net_namespaces(struct ucounts *ucounts)
{
dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
}
/* /*
* setup_net runs the initializers for the network namespace object. * setup_net runs the initializers for the network namespace object.
*/ */
...@@ -320,6 +310,16 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns) ...@@ -320,6 +310,16 @@ static __net_init int setup_net(struct net *net, struct user_namespace *user_ns)
#ifdef CONFIG_NET_NS #ifdef CONFIG_NET_NS
static struct ucounts *inc_net_namespaces(struct user_namespace *ns)
{
return inc_ucount(ns, current_euid(), UCOUNT_NET_NAMESPACES);
}
static void dec_net_namespaces(struct ucounts *ucounts)
{
dec_ucount(ucounts, UCOUNT_NET_NAMESPACES);
}
static struct kmem_cache *net_cachep; static struct kmem_cache *net_cachep;
static struct workqueue_struct *netns_wq; static struct workqueue_struct *netns_wq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment