[Devel] [PATCH RHEL7 COMMIT] net: fix netns accounting on error handling
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 18 16:24:04 MSK 2018
The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.11
------>
commit a31646a53bd3c06fa9444c2af58ceff30025d10b
Author: Vasily Averin <vvs at virtuozzo.com>
Date: Thu Oct 18 16:24:02 2018 +0300
net: fix netns accounting on error handling
Fixes: d0139b975f03 ("ve/netns: limit number of network namespaces per
container")
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
net/core/net_namespace.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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