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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 18 19:21:23 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.11.6.vz7.42.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.6.vz7.42.1
------>
commit b5b81e3d09374b012bd514b816359d162d1b56e7
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu Jan 18 19:21:23 2018 +0300

    ve/netns: fix counting of network namespaces limits
    
    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);
 	}
 


More information about the Devel mailing list