DAMON development mailing list
 help / color / mirror / Atom feed
From: SJ Park <sj@kernel.org>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: SJ Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon/sysfs-schemes: fix tried_regions setup failure cleanup
Date: Wed,  8 Jul 2026 07:17:46 -0700	[thread overview]
Message-ID: <20260708141747.123596-1-sj@kernel.org> (raw)
In-Reply-To: <20260708080107.727043-1-lgs201920130244@gmail.com>

Hello Guangshuo,

On Wed,  8 Jul 2026 16:01:07 +0800 Guangshuo Li <lgs201920130244@gmail.com> wrote:

> damon_sysfs_scheme_add_dirs() sets up the tried_regions directory after
> the stats directory has already been created.
> 
> If damon_sysfs_scheme_set_tried_regions() fails, scheme->tried_regions
> has not been assigned. The error path nevertheless jumps to
> put_tried_regions_out and dereferences scheme->tried_regions while
> trying to put its kobject.
> 
> This can dereference uninitialized memory because struct
> damon_sysfs_scheme is allocated with kmalloc-style allocation and
> scheme->tried_regions is only assigned after tried_regions setup
> succeeds.
> 
> On tried_regions setup failure, start cleanup from the last successfully
> created directory, stats, instead of trying to put tried_regions.

Thank you for this patch!  However, it seems a same fix is already merged into
the mainline as commit 05ea83ee88ca ("mm/damon/sysfs-schemes: put stats for
scheme_add_dirs() internal error").

So, unfortunately we will not be able to merge this patch.


Thanks,
SJ

[...]

      parent reply	other threads:[~2026-07-08 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  8:01 [PATCH] mm/damon/sysfs-schemes: fix tried_regions setup failure cleanup Guangshuo Li
2026-07-08  8:20 ` sashiko-bot
2026-07-08 14:22   ` SJ Park
2026-07-08 14:17 ` SJ Park [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260708141747.123596-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox