aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeongJae Park <[email protected]>2022-10-02 19:31:30 +0000
committerAndrew Morton <[email protected]>2022-10-11 19:05:44 -0700
commitb1f44cdabad8c50cd72d6b6731e9fdf3730a8f4f (patch)
tree74abfe2c7fddf9946c1c768d3a1442bb57053bc4
parentfac35ba763ed07ba93154c95ffc0c4a55023707f (diff)
mm/damon/core: initialize damon_target->list in damon_new_target()
'struct damon_target' creation function, 'damon_new_target()' is not initializing its '->list' field, unlike other DAMON structs creator functions such as 'damon_new_region()'. Normal users of 'damon_new_target()' initializes the field by adding the target to DAMON context's targets list, but some code could access the uninitialized field. This commit avoids the case by initializing the field in 'damon_new_target()'. Link: https://lkml.kernel.org/r/[email protected] Fixes: f23b8eee1871 ("mm/damon/core: implement region-based sampling") Signed-off-by: SeongJae Park <[email protected]> Reported-by: Hyeonggon Yoo <[email protected]> Tested-by: Hyeonggon Yoo <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
-rw-r--r--mm/damon/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 7d25dc582fe3..4cbe7867b547 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -313,6 +313,7 @@ struct damon_target *damon_new_target(void)
t->pid = NULL;
t->nr_regions = 0;
INIT_LIST_HEAD(&t->regions_list);
+ INIT_LIST_HEAD(&t->list);
return t;
}