From: Peter Zijlstra <peterz@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, Major Chen <major.chen@samsung.com>,
stable <stable@kernel.org>, Kuyo Chang <kuyo.chang@mediatek.com>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Matthias Brugger <matthias.bgg@gmail.com>
Subject: Re: [PATCH 2/2] sched/debug: fix dentry leak in update_sched_domain_debugfs
Date: Fri, 2 Sep 2022 14:59:42 +0200 [thread overview]
Message-ID: <YxH+PlfhOV6ZrnrA@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20220902123107.109274-2-gregkh@linuxfoundation.org>
On Fri, Sep 02, 2022 at 02:31:07PM +0200, Greg Kroah-Hartman wrote:
> Kuyo reports that the pattern of using debugfs_remove(debugfs_lookup())
> leaks a dentry and with a hotplug stress test, the machine eventually
> runs out of memory.
>
> Fix this up by using the newly created debugfs_lookup_and_remove() call
> instead which properly handles the dentry reference counting logic.
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> kernel/sched/debug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index bb3d63bdf4ae..667876da8382 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -416,7 +416,7 @@ void update_sched_domain_debugfs(void)
> char buf[32];
>
> snprintf(buf, sizeof(buf), "cpu%d", cpu);
> - debugfs_remove(debugfs_lookup(buf, sd_dentry));
> + debugfs_lookup_and_remove(buf, sd_dentry);
> d_cpu = debugfs_create_dir(buf, sd_dentry);
>
> i = 0;
> --
> 2.37.3
>
next prev parent reply other threads:[~2022-09-02 14:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 12:31 [PATCH 1/2] debugfs: add debugfs_lookup_and_remove() Greg Kroah-Hartman
2022-09-02 12:31 ` [PATCH 2/2] sched/debug: fix dentry leak in update_sched_domain_debugfs Greg Kroah-Hartman
2022-09-02 12:46 ` Greg Kroah-Hartman
2022-09-02 12:59 ` Peter Zijlstra [this message]
2022-09-02 14:59 ` [PATCH 1/2 v2] debugfs: add debugfs_lookup_and_remove() Greg Kroah-Hartman
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=YxH+PlfhOV6ZrnrA@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=gregkh@linuxfoundation.org \
--cc=juri.lelli@redhat.com \
--cc=kuyo.chang@mediatek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=major.chen@samsung.com \
--cc=matthias.bgg@gmail.com \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
--cc=stable@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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
all inboxes | Powered by JetHome®