android_kernel_samsung_sm8650/mm/damon
SeongJae Park f5a0a8bc43 UPSTREAM: mm/damon/sysfs: check DAMOS regions update progress from before_terminate()
DAMON_SYSFS can receive DAMOS tried regions update request while kdamond
is already out of the main loop and before_terminate callback
(damon_sysfs_before_terminate() in this case) is not yet called.  And
damon_sysfs_handle_cmd() can further be finished before the callback is
invoked.  Then, damon_sysfs_before_terminate() unlocks damon_sysfs_lock,
which is not locked by anyone.  This happens because the callback function
assumes damon_sysfs_cmd_request_callback() should be called before it.
Check if the assumption was true before doing the unlock, to avoid this
problem.

Link: https://lkml.kernel.org/r/20231007200432.3110-1-sj@kernel.org
Fixes: f1d13cacabe1 ("mm/damon/sysfs: implement DAMOS tried regions update command")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>	[6.2.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 76b7069bcc89dec33f03eb08abee165d0306b754)

Bug: 300502883
Change-Id: I7cd5e00c0d0226dc8d7856d103f88a26307cafce
Signed-off-by: cui yangpei <cuiyangpei@xiaomi.com>
2023-12-16 01:38:42 +00:00
..
core-test.h mm/damon/core-test: test damon_set_regions 2022-10-03 14:03:06 -07:00
core.c UPSTREAM: mm/damon/core: skip apply schemes if empty 2023-12-16 01:38:42 +00:00
dbgfs-test.h mm/damon/dbgfs-test: fix is_target_id() change 2022-03-22 15:57:12 -07:00
dbgfs.c mm/damon/dbgfs: check if rm_contexts input is for a real context 2022-11-08 15:57:25 -08:00
Kconfig mm/damon/Kconfig: notify debugfs deprecation plan 2022-10-03 14:03:06 -07:00
lru_sort.c UPSTREAM: mm/damon: use kstrtobool() instead of strtobool() 2023-12-16 01:38:42 +00:00
Makefile UPSTREAM: mm/damon/modules: deduplicate init steps for DAMON context setup 2023-12-16 01:38:42 +00:00
modules-common.c UPSTREAM: mm/damon/modules: deduplicate init steps for DAMON context setup 2023-12-16 01:38:42 +00:00
modules-common.h UPSTREAM: mm/damon/modules: deduplicate init steps for DAMON context setup 2023-12-16 01:38:42 +00:00
ops-common.c UPSTREAM: mm/damon/ops-common: refactor to use {pte|pmd}p_clear_young_notify() 2023-12-16 01:38:42 +00:00
ops-common.h mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00
paddr.c mm/damon/ops-common: atomically test and clear young on ptes and pmds 2023-07-19 16:22:11 +02:00
reclaim.c UPSTREAM: mm/damon: use kstrtobool() instead of strtobool() 2023-12-16 01:38:42 +00:00
sysfs-common.c UPSTREAM: mm/damon/sysfs: move unsigned long range directory to common module 2023-12-16 01:38:42 +00:00
sysfs-common.h UPSTREAM: mm/damon/sysfs: implement a command for updating only schemes tried total bytes 2023-12-16 01:38:42 +00:00
sysfs-schemes.c UPSTREAM: mm/damon/sysfs: implement a command for updating only schemes tried total bytes 2023-12-16 01:38:42 +00:00
sysfs.c UPSTREAM: mm/damon/sysfs: check DAMOS regions update progress from before_terminate() 2023-12-16 01:38:42 +00:00
vaddr-test.h mm/damon/vaddr-test: fix memory leak in damon_do_test_apply_three_regions() 2023-10-06 14:57:03 +02:00
vaddr.c This is the 6.1.39 stable release 2023-09-02 19:41:42 +00:00