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

Submitted by Pavel Tikhomirov on Jan. 17, 2018, 3:42 p.m.

Details

Message ID 20180117154216.16321-1-ptikhomirov@virtuozzo.com
State New
Series "ve/netns: fix counting of network namespaces limits"
Headers show

Commit Message

Pavel Tikhomirov Jan. 17, 2018, 3:42 p.m.
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@virtuozzo.com>
---
 net/core/net_namespace.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

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);
 	}