linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Josh Law <objecting@objecting.org>
To: SeongJae Park <sj@kernel.org>
Cc: akpm@linux-foundation.org, damon@lists.linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 2/4] mm/damon/sysfs: check contexts->nr before clear_schemes_tried_regions
Date: Fri, 20 Mar 2026 15:56:09 +0000	[thread overview]
Message-ID: <E4735091-5CE2-42C7-BAF8-B74E49791829@objecting.org> (raw)
In-Reply-To: <20260320155115.101025-1-sj@kernel.org>



On 20 March 2026 15:51:14 GMT, SeongJae Park <sj@kernel.org> wrote:
>On Fri, 20 Mar 2026 15:14:54 +0000 Josh Law <objecting@objecting.org> wrote:
>
>> 
>> 
>> On 20 March 2026 14:47:40 GMT, SeongJae Park <sj@kernel.org> wrote:
>> >On Fri, 20 Mar 2026 07:06:48 +0000 Josh Law <objecting@objecting.org> wrote:
>> >
>> >> 
>> >> 
>> >> On 20 March 2026 02:13:17 GMT, SeongJae Park <sj@kernel.org> wrote:
>> >> >On Thu, 19 Mar 2026 15:57:40 +0000 Josh Law <objecting@objecting.org> wrote:
>[...]
>> >> >Not necessarily blocker of this patch, but seems all the issues are in a same
>> >> >category.  The third patch of this series is also fixing one of the category
>> >> >bugs.  How about fixing all at once by checking kdamond->contexts->nr at the
>> >> >beginning of damon_sysfs_handle_cmd(), like below?
>> >> >
>> >> >--- a/mm/damon/sysfs.c
>> >> >+++ b/mm/damon/sysfs.c
>> >> >@@ -2404,6 +2404,9 @@ static int damon_sysfs_update_schemes_tried_regions(
>> >> > static int damon_sysfs_handle_cmd(enum damon_sysfs_cmd cmd,
>> >> >                struct damon_sysfs_kdamond *kdamond)
>> >> > {
>> >> >+       if (cmd != DAMON_SYSFS_CMD_OFF && kdamond->contexts->nr != 1)
>> >> >+               return -EINVAL;
>> >> >+
>> >> >        switch (cmd) {
>> >> >        case DAMON_SYSFS_CMD_ON:
>> >> >                return damon_sysfs_turn_damon_on(kdamond);
>> >> >
>> >> >If we pick this, Fixes: would be deserve to the oldest buggy commit that
>> >> >introduced the first bug of this category.  It is indeed quite old.
>> >> >
>> >> >Fixes: 0ac32b8affb5 ("mm/damon/sysfs: support DAMOS stats")
>> >> >Cc: <stable@vger.kernel.org> # 5.18.x
>> >> >
>> >> >
>> >> >Thanks,
>> >> >SJ
>> >> 
>> >> 
>> >> 
>> >> Hello, did you give Reviewed by you? Or not..
>> >
>> >Are you meaning Reviewed-by: tag?  If so, no, not yet.  I want to get your
>> >answer to above question first.  Could you please answer?
>> >
>> >
>> >Thanks,
>> >SJ
>> >
>> >[...]
>> 
>> 
>> Well, two is in the same catagory. But seperate fixes may be best.  Because patch 3 dont call that function, so it may be screwy, i mean, if you want me to. Ill guard it. But its a bit on the hacky side
>
>I agree there could be more cleaner way.  But these fixes need to go to stable,
>so I'd prefer a change that also easier to backport.
>
>So, yes, I want to.  Thank you for kindly accepting my suggestion.
>
>Could you please re-post this series for the first and the fourth patches as
>they are, after adding my Reviewed-by:, Fixes: and Cc: stable tags, and a patch
>checking kdamond->contexts->nr at the beginning of damon_sysfs_handle_cmd() as
>I suggested?
>
>
>Thanks,
>SJ
>
>[...]


Absolutely!

Will do


  reply	other threads:[~2026-03-20 15:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 15:57 [PATCH 0/4] mm/damon/sysfs: fix resource leak and NULL pointer dereferences Josh Law
2026-03-19 15:57 ` [PATCH 1/4] mm/damon/sysfs: fix param_ctx leak on damon_sysfs_new_test_ctx() failure Josh Law
2026-03-20  2:00   ` SeongJae Park
2026-03-19 15:57 ` [PATCH 2/4] mm/damon/sysfs: check contexts->nr before clear_schemes_tried_regions Josh Law
2026-03-20  2:13   ` SeongJae Park
2026-03-20  7:06     ` Josh Law
2026-03-20 14:47       ` SeongJae Park
2026-03-20 15:14         ` Josh Law
2026-03-20 15:51           ` SeongJae Park
2026-03-20 15:56             ` Josh Law [this message]
2026-03-19 15:57 ` [PATCH 3/4] mm/damon/sysfs: check contexts->nr in update_schemes_tried_regions Josh Law
2026-03-20  2:15   ` SeongJae Park
2026-03-19 15:57 ` [PATCH 4/4] mm/damon/sysfs: check contexts->nr in repeat_call_fn Josh Law
2026-03-20  2:06   ` SeongJae Park
2026-03-19 19:24 ` [PATCH 0/4] mm/damon/sysfs: fix resource leak and NULL pointer dereferences Josh Law

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=E4735091-5CE2-42C7-BAF8-B74E49791829@objecting.org \
    --to=objecting@objecting.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.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