Skip to contentSkip to conversation

mm-damon-core-disallow-non-power-of-two-min_region_sz-on-damon_start.patch removed from -mm tree

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

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/damon/core: disallow non-power of two min_region_sz on damon_start()
has been removed from the -mm tree. Its filename was
mm-damon-core-disallow-non-power-of-two-min_region_sz-on-damon_start.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/core: disallow non-power of two min_region_sz on damon_start()
Date: Sat, 11 Apr 2026 14:36:36 -0700

Commit d8f867fa0825 ("mm/damon: add damon_ctx->min_sz_region") introduced a bug that allows unaligned DAMON region address ranges. Commit c80f46ac228b ("mm/damon/core: disallow non-power of two min_region_sz") fixed it, but only for damon_commit_ctx() use case. Still, DAMON sysfs interface can emit non-power of two min_region_sz via damon_start(). Fix the path by adding the is_power_of_2() check on damon_start().

The issue was discovered by sashiko [1].

---

 mm/damon/core.c |    5 +++++
 1 file changed, 5 insertions(+)
mm/damon/core.c renamed from mm/damon/core.c~mm-damon-core-disallow-non-power-of-two-min_region_sz-on-damon_start +5 -0
@@ -1368,6 +1368,11 @@ int damon_start(struct damon_ctx **ctxs,
 	int i;
 	int err = 0;
 
+	for (i = 0; i < nr_ctxs; i++) {
+		if (!is_power_of_2(ctxs[i]->min_region_sz))
+			return -EINVAL;
+	}
+
 	mutex_lock(&damon_lock);
 	if ((exclusive && nr_running_ctxs) ||
 			(!exclusive && running_exclusive_ctxs)) {

_

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