Skip to contentSkip to conversation

mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break()

RFC PATCH New SeongJae Park 1 participant 1 message Apr 25

Subsystems (3)
lore
Share & tools
lore

SeongJae Park

author maintainer
#0 lore raw

RFC PATCH 1/1 mm/damon/sysfs-schemes: call missing mem_cgroup_iter_break()

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/[email protected]

Fixes 29cbb9a13f05 ("mm/damon/sysfs-schemes: implement scheme filters")
Cc <[email protected]> # 6.3.x
---
 mm/damon/sysfs-schemes.c | 1 +
 1 file changed, 1 insertion(+)
mm/damon/sysfs-schemes.c +1 -0
index 245d63808411a..04746cbb33272 100644
@@ -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

Signature · 1 line
2.47.3