Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1632390

[PATCH net-next] net: Initialise init_net.count to 1

From David Howells <dhowells@redhat.com>
Newsgroups linux.kernel
Subject [PATCH net-next] net: Initialise init_net.count to 1
Date 2017-04-27 23:50 +0200
Message-ID <tAZst-6vN-7@gated-at.bofh.it> (permalink)
Organization Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903

Show all headers | View raw


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>
---

 net/core/net_namespace.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 652468ff65b7..adb97ca141b7 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);
 

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH net-next] net: Initialise init_net.count to 1 David Howells <dhowells@redhat.com> - 2017-04-27 23:50 +0200
  Re: [PATCH net-next] net: Initialise init_net.count to 1 David Miller <davem@davemloft.net> - 2017-05-01 04:40 +0200

csiph-web