Skip to contentSkip to conversation

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

PATCH Applied SeongJae Park 1 participant 1 message Apr 26

Subsystems (3)
lore
Share & tools
lore

SeongJae Park

author maintainer
#0 lore raw

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

---
Changes from RFC
- rfc: https://lore.kernel.org/[email protected]
- Rebase to latest mm-new.

 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: 63037c6230622d20536f4327a162b82cd59fb483

Signature · 1 line
2.47.3