mm/damon/sysfs: use dynamically allocated repeat mode damon_call_control
authorSeongJae Park <sj@kernel.org>
Mon, 8 Sep 2025 20:15:13 +0000 (13:15 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 13 Sep 2025 20:05:36 +0000 (13:05 -0700)
commit04a06b139ec08aa63d7377f6d3e5218f8ddb1c5d
treefb845a8d624f580e59c5904835ff1e52c0de70b4
parente6a0deb6fa5b0fc134ee2aa127d1cfc9456d8445
mm/damon/sysfs: use dynamically allocated repeat mode damon_call_control

DAMON sysfs interface is using a single global repeat mode
damon_call_control variable for refresh_ms handling, for all DAMON
contexts.  As a result, when there are more than one context, the single
global damon_call_control is unexpectedly over-written (corrupted).
Particularly the ->link field is overwritten by the multiple contexts and
this can cause a user hangup, and/or a kernel crash.  Fix it by using
dynamically allocated damon_call_control object per DAMON context.

Link: https://lkml.kernel.org/r/20250908201513.60802-3-sj@kernel.org
Link: https://lore.kernel.org/20250904011738.930-1-yunjeong.mun@sk.com
Link: https://lore.kernel.org/20250905035411.39501-1-sj@kernel.org
Fixes: d809a7c64ba8 ("mm/damon/sysfs: implement refresh_ms file internal work")
Signed-off-by: SeongJae Park <sj@kernel.org>
Reported-by: Yunjeong Mun <yunjeong.mun@sk.com>
Closes: https://lore.kernel.org/20250904011738.930-1-yunjeong.mun@sk.com
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/sysfs.c