summaryrefslogtreecommitdiffstats
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-04-27 22:40:23 +0100
committerDavid S. Miller <davem@davemloft.net>2017-04-30 22:32:16 -0400
commitb5082df8019ac47ff1e6b6454480e39d0223fc46 (patch)
tree2f9b00cd0df7065e949255aa6d3256c80efe4c4a /net/core/net_namespace.c
parent5e0740c445e6ae4026f5e52456ff8d0be9725183 (diff)
downloadlinux-0-day-b5082df8019ac47ff1e6b6454480e39d0223fc46.tar.gz
linux-0-day-b5082df8019ac47ff1e6b6454480e39d0223fc46.tar.xz
net: Initialise init_net.count to 1
Initialise init_net.count to 1 for its pointer from init_nsproxy lest someone tries to do a get_net() and a put_net() in a process in which current->ns_proxy->net_ns points to the initial network namespace. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index c1d8aed8e5a8f..1934efd4a9d49 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -35,7 +35,8 @@ LIST_HEAD(net_namespace_list);
EXPORT_SYMBOL_GPL(net_namespace_list);
struct net init_net = {
- .dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
+ .count = ATOMIC_INIT(1),
+ .dev_base_head = LIST_HEAD_INIT(init_net.dev_base_head),
};
EXPORT_SYMBOL(init_net);