[Devel] [PATCH RHEL7 COMMIT] kernel/bc: fix beancounter IDs leaks

Konstantin Khorenko khorenko at virtuozzo.com
Tue Aug 14 19:26:24 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.9.1.vz7.70.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.9.1.vz7.70.5
------>
commit d775cc6925e8425f7bb6eee8724728fbcd67f20e
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Tue Aug 14 19:26:24 2018 +0300

    kernel/bc: fix beancounter IDs leaks
    
    Even though the beancounter cgroup sets '.use_id = true'
    it doesn't free used id in cgroup destruction path as it should
    
    This makes impossible to create/destroy beancounter cgroup more
    than 65535 times as mkdir will fail with ENOSPC.
    
    call free_css_id() from ub_cgroup_css_free() to release used id.
    
    https://jira.sw.ru/browse/PSBM-87670
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 kernel/bc/beancounter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/bc/beancounter.c b/kernel/bc/beancounter.c
index 2cc0bca5b353..d8078eea727f 100644
--- a/kernel/bc/beancounter.c
+++ b/kernel/bc/beancounter.c
@@ -549,6 +549,8 @@ static void ub_cgroup_css_free(struct cgroup *cg)
 	struct user_beancounter *ub = cgroup_ub(cg);
 	int i;
 
+	free_css_id(&ub_subsys, &ub->css);
+
 	for (i = 0; i < NR_UB_BOUND_CGROUPS; i++)
 		__ub_set_css(ub, i, NULL);
 


More information about the Devel mailing list