mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
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: 3607cc590f
("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>
This commit is contained in:
parent
9a6a6a3191
commit
63f5dec167
@ -845,6 +845,18 @@ static struct damos_filter *damos_nth_filter(int n, struct damos *s)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct damos_filter *damos_nth_ops_filter(int n, struct damos *s)
|
||||||
|
{
|
||||||
|
struct damos_filter *filter;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
damos_for_each_ops_filter(filter, s) {
|
||||||
|
if (i++ == n)
|
||||||
|
return filter;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void damos_commit_filter_arg(
|
static void damos_commit_filter_arg(
|
||||||
struct damos_filter *dst, struct damos_filter *src)
|
struct damos_filter *dst, struct damos_filter *src)
|
||||||
{
|
{
|
||||||
@ -908,7 +920,7 @@ static int damos_commit_ops_filters(struct damos *dst, struct damos *src)
|
|||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
|
|
||||||
damos_for_each_ops_filter_safe(dst_filter, next, dst) {
|
damos_for_each_ops_filter_safe(dst_filter, next, dst) {
|
||||||
src_filter = damos_nth_filter(i++, src);
|
src_filter = damos_nth_ops_filter(i++, src);
|
||||||
if (src_filter)
|
if (src_filter)
|
||||||
damos_commit_filter(dst_filter, src_filter);
|
damos_commit_filter(dst_filter, src_filter);
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user