public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup: free cset links on find_css_set() failure
@ 2026-02-18 12:05 Kaushlendra Kumar
  2026-02-18 17:03 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Kaushlendra Kumar @ 2026-02-18 12:05 UTC (permalink / raw)
  To: tj, hannes, mkoutny; +Cc: cgroups, Kaushlendra Kumar

When the recursive find_css_set() call for the domain
cset fails, tmp_links allocated earlier are not freed,
causing a memory leak.

Free tmp_links before returning NULL to prevent the leak.

Fixes: 454000adaa2a ("cgroup: introduce cgroup->dom_cgrp and threaded css_set handling")

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
 kernel/cgroup/cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 5f0d33b04910..b1f66311e8d3 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -1308,6 +1308,7 @@ static struct css_set *find_css_set(struct css_set *old_cset,
 		dcset = find_css_set(cset, cset->dfl_cgrp->dom_cgrp);
 		if (!dcset) {
 			put_css_set(cset);
+			free_cgrp_cset_links(&tmp_links);
 			return NULL;
 		}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-21  3:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-18 12:05 [PATCH] cgroup: free cset links on find_css_set() failure Kaushlendra Kumar
2026-02-18 17:03 ` Tejun Heo
2026-02-21  3:35   ` Kumar, Kaushlendra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox