]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/core: initialize damon_target->list in damon_new_target()
authorSeongJae Park <sj@kernel.org>
Sun, 2 Oct 2022 19:31:30 +0000 (19:31 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 12 Oct 2022 02:05:44 +0000 (19:05 -0700)
commitc4ffb56f2e7570922d4ce61a7bc7e6822c4afbf8
tree74abfe2c7fddf9946c1c768d3a1442bb57053bc4
parent95341ba9e90928a9f5322d3d9d9a29c9e3367ecf
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/20221002193130.8227-1-sj@kernel.org
Fixes: 8ccd32e8948f ("mm/damon/core: implement region-based sampling")
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Tested-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/core.c