Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm/damon/core: fix commit_ops_filters by using correct nth function

damos_commit_ops_filters() incorrectly uses damos_nth_filter() which
iterates core_filters. As a result, performing a commit unintentionally
corrupts ops_filters.

Add damos_nth_ops_filter() which iterates ops_filters. Use this function
to fix issues caused by wrong iteration.

Link: https://lkml.kernel.org/r/20250810124201.15743-1-ekffu200098@gmail.com
Fixes: 3607cc590f18 ("mm/damon/core: support committing ops_filters") # 6.15.x
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Sang-Heon Jeon and committed by
Andrew Morton
63f5dec1 9a6a6a31

+13 -1
+13 -1
mm/damon/core.c
··· 845 845 return NULL; 846 846 } 847 847 848 + static struct damos_filter *damos_nth_ops_filter(int n, struct damos *s) 849 + { 850 + struct damos_filter *filter; 851 + int i = 0; 852 + 853 + damos_for_each_ops_filter(filter, s) { 854 + if (i++ == n) 855 + return filter; 856 + } 857 + return NULL; 858 + } 859 + 848 860 static void damos_commit_filter_arg( 849 861 struct damos_filter *dst, struct damos_filter *src) 850 862 { ··· 920 908 int i = 0, j = 0; 921 909 922 910 damos_for_each_ops_filter_safe(dst_filter, next, dst) { 923 - src_filter = damos_nth_filter(i++, src); 911 + src_filter = damos_nth_ops_filter(i++, src); 924 912 if (src_filter) 925 913 damos_commit_filter(dst_filter, src_filter); 926 914 else