[Devel] [PATCH RH7] ve/netns: fix counting of network namespaces limits

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed Jan 17 18:42:16 MSK 2018


If net_alloc fails we leak netns_avail_nr counter when it should be
incremented back.

Fixes commit a408265ce710 ("ve/netns: limit number of network namespaces
per container")

Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 net/core/net_namespace.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 7866da3c100a..f2e00e3b34da 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -397,6 +397,7 @@ struct net *copy_net_ns(unsigned long flags,
 	net = net_alloc();
 	if (!net) {
 		dec_net_namespaces(ucounts);
+		atomic_inc(&ve->netns_avail_nr);
 		return ERR_PTR(-ENOMEM);
 	}
 
-- 
2.14.3



More information about the Devel mailing list