Skip to content

Commit 7071537

Browse files
lienzeakpm00
authored andcommitted
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: ab82e57 ("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>
1 parent cec944d commit 7071537

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mm/damon/core.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ void damon_destroy_scheme(struct damos *s)
452452
damos_for_each_filter_safe(f, next, s)
453453
damos_destroy_filter(f);
454454

455+
damos_for_each_ops_filter_safe(f, next, s)
456+
damos_destroy_filter(f);
457+
455458
kfree(s->migrate_dests.node_id_arr);
456459
kfree(s->migrate_dests.weight_arr);
457460
damon_del_scheme(s);

0 commit comments

Comments
 (0)