Skip to contentSkip to conversation

mm-damon-sysfs-dealloc-repeat_call_control-if-damon_call-fails.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Apr 6 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/sysfs: dealloc repeat_call_control if damon_call() fails
has been removed from the -mm tree. Its filename was
mm-damon-sysfs-dealloc-repeat_call_control-if-damon_call-fails.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: SeongJae Park <[email protected]>
Subject: mm/damon/sysfs: dealloc repeat_call_control if damon_call() fails
Date: Thu, 26 Mar 2026 17:32:22 -0700

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].

Fixes 04a06b139ec0 ("mm/damon/sysfs: use dynamically allocated repeat mode damon_call_control")
Cc <[email protected]> [6.17+]

---

 mm/damon/sysfs.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
mm/damon/sysfs.c renamed from mm/damon/sysfs.c~mm-damon-sysfs-dealloc-repeat_call_control-if-damon_call-fails +2 -1
@@ -1670,7 +1670,8 @@ static int damon_sysfs_turn_damon_on(str
 	repeat_call_control->data = kdamond;
 	repeat_call_control->repeat = true;
 	repeat_call_control->dealloc_on_cancel = true;
-	damon_call(ctx, repeat_call_control);
+	if (damon_call(ctx, repeat_call_control))
+		kfree(repeat_call_control);
 	return err;
 }
 

_

Patches currently in -mm which might be from [email protected] are

mm-damon-core-fix-damon_call-vs-kdamond_fn-exit-race.patch mm-damon-core-fix-damos_walk-vs-kdamond_fn-exit-race.patch mm-damon-core-validate-damos_quota_goal-nid-for-node_mem_usedfree_bp.patch mm-damon-core-validate-damos_quota_goal-nid-for-node_memcg_usedfree_bp.patch mm-damon-core-use-time_in_range_open-for-damos-quota-window-start.patch docs-admin-guide-mm-damon-reclaim-warn-commit_inputs-vs-param-updates-race.patch docs-admin-guide-mm-damon-lru_sort-warn-commit_inputs-vs-param-updates-race.patch