From: David Howells Date: Thu, 27 Apr 2017 21:40:23 +0000 (+0100) Subject: net: Initialise init_net.count to 1 X-Git-Tag: v4.12-rc1~129^2~47 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b5082df8019ac47ff1e6b6454480e39d0223fc46;p=platform%2Fkernel%2Flinux-exynos.git 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 Signed-off-by: David S. Miller --- diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index c1d8aed8e5a8..1934efd4a9d4 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);