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

Andrey Ryabinin aryabinin at virtuozzo.com
Tue Aug 14 17:22:49 MSK 2018


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



More information about the Devel mailing list