]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm/damon/sysfs: dealloc repeat_call_control if damon_call() fails
authorSeongJae Park <sj@kernel.org>
Fri, 27 Mar 2026 00:32:22 +0000 (17:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Apr 2026 08:46:45 +0000 (10:46 +0200)
commit0655f5cf1735508394ef8af98ddcfab3ac1c1cc5
tree5650cc86eb615aee7afbb317a12e1324c4fd8ca9
parent29ef28e9c3a5fbf63fa4c0dbe284de7172426b32
mm/damon/sysfs: dealloc repeat_call_control if damon_call() fails

commit 0199390a6b92fc21860e1b858abf525c7e73b956 upstream.

damon_call() for repeat_call_control of DAMON_SYSFS could fail if somehow
the kdamond is stopped before the damon_call().  It could happen, for
example, when te damon context was made for monitroing of a virtual
address processes, and the process is terminated immediately, before the
damon_call() invocation.  In the case, the dyanmically allocated
repeat_call_control is not deallocated and leaked.

Fix the leak by deallocating the repeat_call_control under the
damon_call() failure.

This issue is discovered by sashiko [1].

Link: https://lkml.kernel.org/r/20260327003224.55752-1-sj@kernel.org
Link: https://lore.kernel.org/20260320020630.962-1-sj@kernel.org
Fixes: 04a06b139ec0 ("mm/damon/sysfs: use dynamically allocated repeat mode damon_call_control")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org> [6.17+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/damon/sysfs.c