[RH7] netns accounting cleanup

Submitted by Vasily Averin on Oct. 17, 2018, 10:41 a.m.

Details

Message ID 28e17f99-9ac8-8253-c1d7-08dcd45021ca@virtuozzo.com
State New
Series "netns accounting cleanup"
Headers show

Commit Message

Vasily Averin Oct. 17, 2018, 10:41 a.m.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>

Patch hide | download patch | download mbox

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) {