[Devel] [PATCH RHEL7 COMMIT] ve/cgroups: fix subgroups_limit error path handling

Konstantin Khorenko khorenko at virtuozzo.com
Fri May 19 19:44:23 MSK 2023


The commit is pushed to "branch-rh7-3.10.0-1160.88.1.vz7.195.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.88.1.vz7.195.3
------>
commit 7803970eac3ed05cbfcdc074b63d1b6b5b3e8c28
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Fri May 19 11:14:21 2023 +0800

    ve/cgroups: fix subgroups_limit error path handling
    
    We do ida_simple_get on root->cgroup_ida, just before checking
    subgroups_limit, and in case subgroups_limit is reached we don't do
    corresponding ida_simple_remove to free id. Let's fix it by jumping
    to proper goto label err_free_id.
    
    This may or may not be related to [1], found while investigating it.
    
    https://jira.vzint.dev/browse/PSBM-147036 [1]
    Fixes: 92faf0fad3e3 ("ve/cgroups: Introduce subgroups_limit control")
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 kernel/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index f2952d7c18dc..3f8c49b9ebe0 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4888,7 +4888,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
 	if (ve_root && ve_root->subgroups_limit > 0 &&
 			subgroups_count(ve_root) >= ve_root->subgroups_limit) {
 		err = -EACCES;
-		goto err_free_name;
+		goto err_free_id;
 	}
 
 	/*


More information about the Devel mailing list