From: SeongJae Park <sj@kernel.org>
To: Enze Li <lienze@kylinos.cn>
Cc: SeongJae Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
linux-mm@kvack.org, enze.li@gmx.com, stable@vger.kernel.org
Subject: Re: [PATCH] mm/damon/core: fix memory leak of repeat mode damon_call_control objects
Date: Tue, 2 Dec 2025 07:18:34 -0800 [thread overview]
Message-ID: <20251202151834.68713-1-sj@kernel.org> (raw)
In-Reply-To: <20251202082340.34178-1-lienze@kylinos.cn>
On Tue, 2 Dec 2025 16:23:40 +0800 Enze Li <lienze@kylinos.cn> wrote:
> A memory leak exists in the handling of repeat mode damon_call_control
> objects by kdamond_call(). While damon_call() correctly allows multiple
> repeat mode objects (with ->repeat set to true) to be added to the
> per-context list, kdamond_call() incorrectly processes them.
>
> The function moves all repeat mode objects from the context's list to a
> temporary list (repeat_controls). However, it only moves the first
> object back to the context's list for future calls, leaving the
> remaining objects on the temporary list where they are abandoned and
> leaked.
Thank you for quickly updating the description and sending this, Enze. I think
it is also worthy to add the real user impact description.
Andrew, could you please add the below user impact description to the commit
message when you add this to the mm tree?
'''
Note that the leak is not in the real world, and therefore no user is impacted.
It is only potential for imagineray damon_call() use cases that not exist in
the tree for now. In more detail, the leak happens only when the multiple
repeat mode objects are assumed to be deallocated by kdamond_call()
(damon_call_control->dealloc_on_cancel is set). There is no such damon_call()
use cases at the moment.
'''
>
> This patch fixes the leak by ensuring all repeat mode objects are
> properly re-added to the context's list.
>
> Fixes: 43df7676e550 ("mm/damon/core: introduce repeat mode damon_call()")
> Signed-off-by: Enze Li <lienze@kylinos.cn>
> Cc: <stable@vger.kernel.org> # 6.17.x
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
[...]
prev parent reply other threads:[~2025-12-02 15:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 8:23 Enze Li
2025-12-02 15:18 ` SeongJae 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=20251202151834.68713-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=enze.li@gmx.com \
--cc=lienze@kylinos.cn \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.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