Re: [RFC PATCH] mm/damon/core: handle region split failure in apply_min_nr_regions()
From: SJ Park
Date: Fri Jul 17 2026 - 21:16:46 EST
On Fri, 17 Jul 2026 18:03:12 -0700 SJ Park <sj@xxxxxxxxxx> wrote:
> On Fri, 17 Jul 2026 17:43:00 -0700 SJ Park <sj@xxxxxxxxxx> wrote:
>
> > damon_apply_min_nr_regions() repeatedly split each region until its size
> > becomes small enough to meet the user-defined low limit of the number of
> > regions. The loop assumes the split operation (damon_split_region_at())
> > will always succeed and create the new region. But the operation could
> > silently fail for memory allocation failures, for example. If such
> > failure happens and the region was the last region, the linked
> > list-based next region fetching returns invalid pointer. As a result,
> > invalid memory dereference and corruption could happen. Fix by breaking
> > the loop in the corner case.
>
> Sashiko found no blocker for this series. Sashiko sent findings to damon@
> mailing list [1], and I replied to all the comments. Please read those for
> details.
My intention was to add this reply to other mail[1] but I only mistakenly
replied here.
This is true, though. Sashiko found no issue in this patch. But that means
nothing since this is an RFC. I will repost this patch after dropping the RFC
and rebasing to latest mm-new, tomorrow.
[1] https://lore.kernel.org/20260718011322.94001-1-sj@xxxxxxxxxx
>
> [1] https://lore.kernel.org/damon/
Thanks,
SJ
[...]