From: sashiko-bot@kernel.org
To: "SeongJae Park" <sj@kernel.org>
Cc: damon@lists.linux.dev
Subject: Re: [RFC PATCH v1.2 11/11] mm/damon/sysfs-schemes: kobject_del() region for populate_region error
Date: Thu, 18 Jun 2026 15:38:37 +0000 [thread overview]
Message-ID: <20260618153838.5A6251F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618151517.5366-12-sj@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Memory leak in the error path of damon_sysfs_scheme_add_dirs() due to skipped cleanup of the 'stats' kobject.
--
commit 73251d9a8366deae80fbc88ff7d3d42f79676704
Author: SeongJae Park <sj@kernel.org>
mm/damon/sysfs-schemes: kobject_del() region for populate_region error
This patch fixes directory creation failures due to name conflicts when
CONFIG_DEBUG_KOBJECT_RELEASE is enabled. It adds a missing kobject_del()
call to properly clean up tried region directories in the error path of
damos_sysfs_populate_region_dir().
> diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
> index ebc692682481d..0b8a6f1f6b9fc 100644
> --- a/mm/damon/sysfs-schemes.c
> +++ b/mm/damon/sysfs-schemes.c
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but while reviewing the kobject
cleanup in this file, I noticed a memory leak in the error path of
damon_sysfs_scheme_add_dirs():
mm/damon/sysfs-schemes.c:damon_sysfs_scheme_add_dirs() {
...
err = damon_sysfs_scheme_set_stats(scheme);
if (err)
goto put_filters_watermarks_quotas_access_pattern_out;
err = damon_sysfs_scheme_set_tried_regions(scheme);
if (err)
goto put_tried_regions_out;
return 0;
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);
...
}
If damon_sysfs_scheme_set_tried_regions() fails, it jumps to
put_tried_regions_out. This attempts to clean up the failed tried_regions
allocation, but then falls through to the next label.
Does this completely skip cleaning up the successfully allocated
scheme->stats->kobj? Missing a call to kobject_put(&scheme->stats->kobj)
here appears to permanently leak the stats kobject and its associated
sysfs state.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260618151517.5366-1-sj@kernel.org?part=11
prev parent reply other threads:[~2026-06-18 15:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-18 15:15 [RFC PATCH v1.2 00/11] mm/damon/sysfs: kobject_del() directories that users can create/remove SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 01/11] mm/damon/sysfs: kobject_del() target (normal), context and kdamond dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 02/11] mm/damon/sysfs: kobject_del() region and target (error) dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 03/11] mm/damon/sysfs-schemes: kobject_del() scheme dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 04/11] mm/damon/sysfs-schemes: kobject_del() scheme region dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 05/11] mm/damon/sysfs-schemes: kobject_del() scheme filter dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 06/11] mm/damon/sysfs-schemes: kobject_del() scheme quota goal dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 07/11] mm/damon/sysfs-schemes: kobject_del() scheme action destination dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 08/11] mm/damon/sysfs: kobject_del() probe dirs SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 09/11] mm/damon/sysfs: kobject_del() probe filter dirs SeongJae Park
2026-06-18 15:34 ` sashiko-bot
2026-06-18 15:15 ` [RFC PATCH v1.2 10/11] mm/damon/sysfs: kobject_del() probe dirs in probes_addd_dir error path SeongJae Park
2026-06-18 15:15 ` [RFC PATCH v1.2 11/11] mm/damon/sysfs-schemes: kobject_del() region for populate_region error SeongJae Park
2026-06-18 15:38 ` sashiko-bot [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=20260618153838.5A6251F000E9@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