[Devel] [PATCH RH7] netns accounting cleanup

Vasily Averin vvs at virtuozzo.com
Wed Oct 17 13:41:42 MSK 2018


Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
-------------- next part --------------
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 4a799a76f675..71c6881215e5 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -392,8 +392,10 @@ struct net *copy_net_ns(unsigned long flags,
 	if (!ucounts)
 		return ERR_PTR(-ENOSPC);
 
-	if (atomic_dec_if_positive(&ve->netns_avail_nr) < 0)
+	if (atomic_dec_if_positive(&ve->netns_avail_nr) < 0) {
+		dec_net_namespaces(ucounts);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	net = net_alloc();
 	if (!net) {


More information about the Devel mailing list