From: sashiko-bot@kernel.org
To: "SeongJae Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH 4/9] mm/damon/sysfs-schemes: kobject_del() scheme region dirs
Date: Tue, 16 Jun 2026 15:25:35 +0000 [thread overview]
Message-ID: <20260616152536.2481C1F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <20260616150844.88305-5-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Incomplete Fix / Missing kobject_del() in sysfs directory array teardown and error paths.
- [High] Memory leak of `stats` object in `damon_sysfs_scheme_add_dirs()` error path.
--
commit 30488832bf0bcf915d5cbb6c2727b7cdedd8440e
Author: SeongJae Park <sj@kernel.org>
Subject: mm/damon/sysfs-schemes: kobject_del() scheme region dirs
This commit addresses directory creation failures due to name conflicts
when CONFIG_DEBUG_KOBJECT_RELEASE is enabled. It fixes the issue by adding
missing kobject_del() calls before kobject_put() for scheme region
directories during removal.
Link: https://lore.kernel.org/20260517205828.6204-1-sj@kernel.org
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index 37cf6edb54f17..bf08e6e1f1635 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
> @@ -334,6 +334,7 @@ static void damon_sysfs_scheme_regions_rm_dirs(
> list_for_each_entry_safe(r, next, ®ions->regions_list, list) {
> damos_sysfs_region_rm_dirs(r);
> list_del(&r->list);
> + kobject_del(&r->kobj);
[Severity: High]
This is a pre-existing issue, but since we are adding kobject_del() here to
fix the name collision bug, could there be similar omissions in other array
teardown and error paths?
For instance, looking at damos_sysfs_probes_rm_dirs() which is called
just above via damos_sysfs_region_rm_dirs():
mm/damon/sysfs-schemes.c:damos_sysfs_probes_rm_dirs() {
...
for (i = 0; i < probes->nr; i++)
kobject_put(&probes_arr[i]->kobj);
...
}
Does this code also omit kobject_del() during probes array teardown,
potentially leaving directories in sysfs during array resizing?
Similarly, in several initialization loop error paths, such as in
damos_sysfs_populate_region_dir():
mm/damon/sysfs-schemes.c:damos_sysfs_populate_region_dir() {
...
out:
kobject_put(®ion->kobj);
}
If aborting region population, does this path fail to call kobject_del(),
breaking subsequent retries by leaving the directory name occupied?
Other functions like damon_sysfs_schemes_add_dirs(),
damon_sysfs_targets_add_dirs(), and damon_sysfs_contexts_add_dirs()
appear to have the same out path pattern omitting kobject_del() for
partially added objects. Would it make sense to update those paths as well?
> kobject_put(&r->kobj);
[Severity: High]
This is a pre-existing issue, but I noticed a potential memory leak in
an error path nearby.
In damon_sysfs_scheme_add_dirs(), the error cleanup sequence handles
dropping the tried_regions and then ops_filters:
mm/damon/sysfs-schemes.c:damon_sysfs_scheme_add_dirs() {
...
put_tried_regions_out:
kobject_put(&scheme->tried_regions->kobj);
scheme->tried_regions = NULL;
put_filters_watermarks_quotas_access_pattern_out:
kobject_put(&scheme->ops_filters->kobj);
...
}
Does this error path completely omit dropping the stats kobject?
The stats kobject is initialized prior to the failed call, so
wouldn't skipping kobject_put(&scheme->stats->kobj) leak it permanently?
> regions->nr_regions--;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260616150844.88305-1-sj@kernel.org?part=4
next prev parent reply other threads:[~2026-06-16 15:25 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 [this message]
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
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=20260616152536.2481C1F00A3F@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox