From: sashiko-bot@kernel.org
To: "SeongJae Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 7/9] mm/damon/sysfs-schemes: kobject_del() scheme action destination dirs
Date: Tue, 16 Jun 2026 15:34:09 +0000 [thread overview]
Message-ID: <20260616153409.CCDD31F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260616150844.88305-8-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Missing `kobject_del()` calls on the error paths of numerous `_add_dirs` initialization loops, leading to delayed-release name conflicts.
--
commit 635dc3a5238027dd7ff5a0100c509a12408d26da
Author: SeongJae Park <sj@kernel.org>
mm/damon/sysfs-schemes: kobject_del() scheme action destination dirs
This commit adds kobject_del() calls to the scheme action destination
directories cleanup routine. This prevents directory creation failures
due to name conflicts when CONFIG_DEBUG_KOBJECT_RELEASE is enabled.
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 737638be84f15..108f6de32f8c1 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
> @@ -2148,8 +2148,10 @@ static void damos_sysfs_dests_rm_dirs(
> struct damos_sysfs_dest **dests_arr = dests->dests_arr;
> int i;
>
> - for (i = 0; i < dests->nr; i++)
> + for (i = 0; i < dests->nr; i++) {
> + kobject_del(&dests_arr[i]->kobj);
> kobject_put(&dests_arr[i]->kobj);
> + }
> dests->nr = 0;
> kfree(dests_arr);
[Severity: High]
This is a pre-existing issue, but should the error paths in the various
_add_dirs() functions also be updated to call kobject_del() to prevent the
same name conflicts?
When kobject_init_and_add() succeeds, the kobject is added to sysfs. If a
subsequent initialization step fails, the error paths call kobject_put()
without calling kobject_del() first. Under CONFIG_DEBUG_KOBJECT_RELEASE,
kobject_put() schedules delayed cleanup, so the sysfs directory remains
visible until the delayed release completes. If the user immediately retries,
kobject_init_and_add() will fail with an -EEXIST name collision.
For example, in mm/damon/sysfs.c:damon_sysfs_targets_add_dirs():
err = kobject_init_and_add(&target->kobj, ...);
if (err)
goto out;
err = damon_sysfs_target_add_dirs(target);
if (err)
goto out;
...
out:
damon_sysfs_targets_rm_dirs(targets);
kobject_put(&target->kobj);
return err;
Does this series also need to add kobject_del() calls to the error paths
of these functions:
- damon_sysfs_targets_add_dirs() in mm/damon/sysfs.c
- damon_sysfs_probes_add_dirs() in mm/damon/sysfs.c
- damon_sysfs_contexts_add_dirs() in mm/damon/sysfs.c
- damon_sysfs_kdamonds_add_dirs() in mm/damon/sysfs.c
- damon_sysfs_schemes_add_dirs() in mm/damon/sysfs-schemes.c
- damos_sysfs_populate_region_dir() in mm/damon/sysfs-schemes.c
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260616150844.88305-1-sj@kernel.org?part=7
next prev parent reply other threads:[~2026-06-16 15:34 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-16 15:08 [RFC PATCH 0/9] mm/damon/sysfs: kobject_del() directories that users can create/remove SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 1/9] mm/damon/sysfs: kobject_del() target, context and kdamond dirs SeongJae Park
2026-06-16 15:25 ` sashiko-bot
2026-06-17 0:02 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 2/9] mm/damon/sysfs: kobject_del() region dirs SeongJae Park
2026-06-16 15:29 ` sashiko-bot
2026-06-17 0:18 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 3/9] mm/damon/sysfs-schemes: kobject_del() scheme dirs SeongJae Park
2026-06-16 15:27 ` sashiko-bot
2026-06-17 0:52 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 4/9] mm/damon/sysfs-schemes: kobject_del() scheme region dirs SeongJae Park
2026-06-16 15:25 ` sashiko-bot
2026-06-17 0:43 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 5/9] mm/damon/sysfs-schemes: kobject_del() scheme filter dirs SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 6/9] mm/damon/sysfs-schemes: kobject_del() scheme quota goal dirs SeongJae Park
2026-06-16 15:27 ` sashiko-bot
2026-06-17 0:55 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 7/9] mm/damon/sysfs-schemes: kobject_del() scheme action destination dirs SeongJae Park
2026-06-16 15:34 ` sashiko-bot [this message]
2026-06-17 1:07 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 8/9] mm/damon/sysfs: kobject_del() probe filter dirs SeongJae Park
2026-06-16 15:27 ` sashiko-bot
2026-06-17 1:10 ` SeongJae Park
2026-06-16 15:08 ` [RFC PATCH 9/9] mm/damon/sysfs: kobject_del() probe dirs SeongJae Park
2026-06-16 15:24 ` sashiko-bot
2026-06-17 1:11 ` SeongJae Park
2026-06-17 1:15 ` [RFC PATCH 0/9] mm/damon/sysfs: kobject_del() directories that users can create/remove 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=20260616153409.CCDD31F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.