public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break()
@ 2026-04-25 20:24 SeongJae Park
  0 siblings, 0 replies; only message in thread
From: SeongJae Park @ 2026-04-25 20:24 UTC (permalink / raw)
  Cc: SeongJae Park, # 6 . 3 . x, Andrew Morton, damon, linux-kernel,
	linux-mm

damon_sysfs_memcg_path_to_id() breaks mem_cgroup_iter() loop without
calling mem_cgroup_iter_break().  This leaks the cgroup reference.  Fix
the issue by calling mem_cgroup_iter_break() before the break.

The issue was discovered [1] by Sashiko.

[1] https://lore.kernel.org/20260423004148.74722-1-sj@kernel.org

Fixes: 29cbb9a13f05 ("mm/damon/sysfs-schemes: implement scheme filters")
Cc: <stable@vger.kernel.org> # 6.3.x
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 mm/damon/sysfs-schemes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 245d63808411a..04746cbb33272 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -2594,6 +2594,7 @@ static int damon_sysfs_memcg_path_to_id(char *memcg_path, u64 *id)
 		if (damon_sysfs_memcg_path_eq(memcg, path, memcg_path)) {
 			*id = mem_cgroup_id(memcg);
 			found = true;
+			mem_cgroup_iter_break(NULL, memcg);
 			break;
 		}
 	}

base-commit: 8aa462c5a7540f9f8882cf8fa6add712fdf38c91
-- 
2.47.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-04-25 20:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-25 20:24 [RFC PATCH] mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break() SeongJae Park

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