linux-stable/mm/damon
SeongJae Park 3479641796 mm/damon/dbgfs: protect targets destructions with kdamond_lock
DAMON debugfs interface iterates current monitoring targets in
'dbgfs_target_ids_read()' while holding the corresponding
'kdamond_lock'.  However, it also destructs the monitoring targets in
'dbgfs_before_terminate()' without holding the lock.  This can result in
a use_after_free bug.  This commit avoids the race by protecting the
destruction with the corresponding 'kdamond_lock'.

Link: https://lkml.kernel.org/r/20211221094447.2241-1-sj@kernel.org
Reported-by: Sangwoo Bae <sangwoob@amazon.com>
Fixes: 4bc05954d0 ("mm/damon: implement a debugfs-based user space interface")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>	[5.15.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-12-25 12:20:56 -08:00
..
core-test.h mm/damon/core-test: fix wrong expectations for 'damon_split_regions_of()' 2021-10-28 17:18:55 -07:00
core.c mm/damon/core: remove unnecessary error messages 2021-12-10 17:10:55 -08:00
dbgfs-test.h mm/damon: fix a few spelling mistakes in comments and a pr_debug message 2021-11-06 13:30:46 -07:00
dbgfs.c mm/damon/dbgfs: protect targets destructions with kdamond_lock 2021-12-25 12:20:56 -08:00
Kconfig mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2021-11-06 13:30:46 -07:00
Makefile mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2021-11-06 13:30:46 -07:00
paddr.c mm/damon/vaddr,paddr: support pageout prioritization 2021-11-06 13:30:45 -07:00
prmtv-common.c mm/damon/vaddr,paddr: support pageout prioritization 2021-11-06 13:30:45 -07:00
prmtv-common.h mm/damon/vaddr,paddr: support pageout prioritization 2021-11-06 13:30:45 -07:00
reclaim.c mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2021-11-06 13:30:46 -07:00
vaddr-test.h mm/damon/vaddr-test: remove unnecessary variables 2021-12-10 17:10:56 -08:00
vaddr.c mm/damon/vaddr: remove an unnecessary warning message 2021-12-10 17:10:56 -08:00