summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorEnze Li <lienze@kylinos.cn>2025-10-14 16:42:25 +0800
committerAndrew Morton <akpm@linux-foundation.org>2025-10-21 15:46:17 -0700
commit7071537159be845a5c4ed5fb7d3db25aa4bd04a3 (patch)
tree0bdc8f7cdc1918bf9f4f63f864bdde7236fc31fa /mm
parentcec944dd329fbefee907da95c298719d900d4787 (diff)
mm/damon/core: fix potential memory leak by cleaning ops_filter in damon_destroy_scheme
Currently, damon_destroy_scheme() only cleans up the filter list but leaves ops_filter untouched, which could lead to memory leaks when a scheme is destroyed. This patch ensures both filter and ops_filter are properly freed in damon_destroy_scheme(), preventing potential memory leaks. Link: https://lkml.kernel.org/r/20251014084225.313313-1-lienze@kylinos.cn Fixes: ab82e57981d0 ("mm/damon/core: introduce damos->ops_filters") Signed-off-by: Enze Li <lienze@kylinos.cn> Reviewed-by: SeongJae Park <sj@kernel.org> Tested-by: SeongJae Park <sj@kernel.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/damon/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 4670d293bbf4..083d314fc4e6 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -452,6 +452,9 @@ void damon_destroy_scheme(struct damos *s)
damos_for_each_filter_safe(f, next, s)
damos_destroy_filter(f);
+ damos_for_each_ops_filter_safe(f, next, s)
+ damos_destroy_filter(f);
+
kfree(s->migrate_dests.node_id_arr);
kfree(s->migrate_dests.weight_arr);
damon_del_scheme(s);