Re: [RFC PATCH 7.3.y] mm/damon/core: error damos_commit_quota_goal() for zero target_value

From: SJ Park

Date: Mon Oct 26 2026 - 09:30:47 EST


Hi Sasha,

On Sun, 25 Oct 2026 19:29:57 -0400 Sasha Levin <sashal@xxxxxxxxxx> wrote:

> > Notes for stable kernel porting. The upstream commit doesn't have
> > Fixes: and therefore not ported to stable kernels. It turned out it
> > fixes commit 8b549a4fd3c5 ("mm/damon/sysfs-schemes: commit damos quota
> > goals user input to DAMOS") which was merged into v6.8. The user impact
> > is a race condition that can result in divide-by-zero. Hence backport.
>
> The older trees don't need this one. The callers in 7.2, 6.18 and 6.12
> already reject a zero target_value (7.2 also has 06befa61c427
> ("mm/damon/lru_sort: error out for >10000 active_mem_bp") and a16fd3ad9d89
> ("samples/damon/mtier: error out for zero quota goal target values")),

That's true. DAMON_LRU_SORT and DAMON_SAMPLE_MTIER are patched to be safe from
this issue. But DAMON sysfs interface can pass zero target_value under a race
condition.

> the
> commit has no Fixes: or Cc: stable,

I didn't know the race condition when I wrote the patch, so didn't add Fixes:
or Cc: stable.

> and it is patch 1/3 of a series whose
> patches 2 and 3 remove those caller-side checks.

I'm not sure if this really matters.

So, I think we still need to add this patch to older kernels. Please let me
know if I'm missing something.


Thanks,
SJ

[...]