]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
net: Initialise init_net.count to 1
authorDavid Howells <dhowells@redhat.com>
Thu, 27 Apr 2017 21:40:23 +0000 (22:40 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 May 2017 02:32:16 +0000 (22:32 -0400)
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>
net/core/net_namespace.c

index c1d8aed8e5a8f304479251504bda3aa0b8242108..1934efd4a9d4986f3497abc40968fd08c91896b3 100644 (file)
@@ -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);