]> git.baikalelectronics.ru Git - kernel.git/commit
mm/damon/sysfs-schemes: skip stats update if the scheme directory is removed
authorSeongJae Park <sj@kernel.org>
Mon, 14 Nov 2022 17:55:52 +0000 (17:55 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 23 Nov 2022 02:50:42 +0000 (18:50 -0800)
commitb09ac3a5699d9f39f828c26e4ac94180d29865e1
tree28702650357ce373cd400e4180f4a4c27cc34d4b
parent855363f19d50ff13f17e42995407937a5dab977a
mm/damon/sysfs-schemes: skip stats update if the scheme directory is removed

A DAMON sysfs interface user can start DAMON with a scheme, remove the
sysfs directory for the scheme, and then ask update of the scheme's stats.
Because the schemes stats update logic isn't aware of the situation, it
results in an invalid memory access.  Fix the bug by checking if the
scheme sysfs directory exists.

Link: https://lkml.kernel.org/r/20221114175552.1951-1-sj@kernel.org
Fixes: 2b911e1e812e ("mm/damon/sysfs: support DAMOS stats")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> [v5.18]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs.c