android_kernel_xiaomi_sm8450/mm/damon
SeongJae Park c3939031fb UPSTREAM: 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: 4bc05954d007 ("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>

(cherry picked from commit 34796417964b8d0aef45a99cf6c2d20cebe33733)

Bug: 228223814
Signed-off-by: Hailong Tu <tuhailong@oppo.com>
Change-Id: I27e10c0e1ccc6c28c5a948a246e45db7a0338bed
2022-04-28 23:09:17 +08:00
..
core-test.h UPSTREAM: mm/damon/core-test: fix wrong expectations for 'damon_split_regions_of()' 2022-04-28 23:09:15 +08:00
core.c UPSTREAM: mm/damon/core: remove unnecessary error messages 2022-04-28 23:09:17 +08:00
dbgfs-test.h UPSTREAM: mm/damon: fix a few spelling mistakes in comments and a pr_debug message 2022-04-28 23:09:16 +08:00
dbgfs.c UPSTREAM: mm/damon/dbgfs: protect targets destructions with kdamond_lock 2022-04-28 23:09:17 +08:00
Kconfig UPSTREAM: mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2022-04-28 23:09:16 +08:00
Makefile UPSTREAM: mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2022-04-28 23:09:16 +08:00
paddr.c UPSTREAM: mm/damon/vaddr,paddr: support pageout prioritization 2022-04-28 23:09:16 +08:00
prmtv-common.c UPSTREAM: mm/damon/vaddr,paddr: support pageout prioritization 2022-04-28 23:09:16 +08:00
prmtv-common.h UPSTREAM: mm/damon/vaddr,paddr: support pageout prioritization 2022-04-28 23:09:16 +08:00
reclaim.c UPSTREAM: mm/damon: introduce DAMON-based Reclamation (DAMON_RECLAIM) 2022-04-28 23:09:16 +08:00
vaddr-test.h UPSTREAM: mm/damon/vaddr-test: remove unnecessary variables 2022-04-28 23:09:17 +08:00
vaddr.c UPSTREAM: mm/damon/vaddr: remove an unnecessary warning message 2022-04-28 23:09:17 +08:00