summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorEnze Li <lienze@kylinos.cn>2025-10-14 16:42:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-29 14:10:25 +0100
commitff8dcf621a4172f4a6d42cbbb25d21659d3ac300 (patch)
treeb05369b788b2c7e633f66b4dca681f7de739c461 /mm
parentca40e83898d61a260428b6f58a6144d76877f0b2 (diff)
downloadlinux-ff8dcf621a4172f4a6d42cbbb25d21659d3ac300.tar.gz
linux-ff8dcf621a4172f4a6d42cbbb25d21659d3ac300.tar.bz2
linux-ff8dcf621a4172f4a6d42cbbb25d21659d3ac300.zip
mm/damon/core: fix potential memory leak by cleaning ops_filter in damon_destroy_scheme
commit 7071537159be845a5c4ed5fb7d3db25aa4bd04a3 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 ce34e5abde79..533c1c2d72f2 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -451,6 +451,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);