From: SeongJae Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH 1/2] mm/damon/reclaim: handle ctx allocation failure
Date: Thu, 28 May 2026 07:00:24 -0700 [thread overview]
Message-ID: <20260528140024.152957-1-sj@kernel.org> (raw)
In-Reply-To: <20260528065054.471371F000E9@smtp.kernel.org>
On Thu, 28 May 2026 06:50:53 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] The patch prevents loading the damon_reclaim module with the 'enabled=Y' parameter by returning -ENOMEM during parameter parsing.
> --
>
> commit d55c0d692febe0a6f116ac49f1c1187ff2f47d7b
> Author: SeongJae Park <sj@kernel.org>
> mm/damon/reclaim: handle ctx allocation failure
>
> This commit adds a check in damon_reclaim_enabled_store() to return -ENOMEM
> if the ctx pointer is NULL. This is intended to prevent a NULL pointer
> dereference if the context allocation failed during initialization.
>
> Cc: stable@vger.kernel.org # 6.18.x
>
> > diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
> > index ed446d00ef1cf..ce4499cf4b8b0 100644
> > --- a/mm/damon/reclaim.c
> > +++ b/mm/damon/reclaim.c
> > @@ -399,6 +399,10 @@ static int damon_reclaim_enabled_store(const char *val,
> > if (!damon_initialized())
> > return 0;
> >
> > + /* damon_modules_new_paddr_ctx_target() in the init function failed. */
> > + if (!ctx)
> > + return -ENOMEM;
> > +
>
> [Severity: High]
> When the damon_reclaim module is loaded with the enabled=Y parameter,
> load_module() calls parse_args() before running the module's
> damon_reclaim_init() function. At this point, damon_initialized()
> returns true since the damon core is already initialized, but ctx is
> still NULL.
>
> Will this new check return -ENOMEM and abort the entire module loading
> process during parameter parsing instead of successfully loading?
DAMON_RECLAIM is not a loadable but static module. So this cannot happen.
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-05-28 14:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 6:11 [RFC PATCH 0/2] mm/damon/{reclaim,lru_sort}: handle ctx allocation failures SeongJae Park
2026-05-28 6:11 ` [RFC PATCH 1/2] mm/damon/reclaim: handle ctx allocation failure SeongJae Park
2026-05-28 6:50 ` sashiko-bot
2026-05-28 14:00 ` SeongJae Park [this message]
2026-05-28 6:11 ` [RFC PATCH 2/2] mm/damonn/lru_sort: " SeongJae Park
2026-05-28 7:29 ` sashiko-bot
2026-05-28 14:02 ` SeongJae Park
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=20260528140024.152957-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-bot@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