From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: "Rafael J . Wysocki" <rafael@kernel.org>,
Kevin Hilman <khilman@kernel.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Thierry Strudel <tstrudel@google.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Pin-yen Lin <treapking@chromium.org>
Subject: Re: [PATCH] PM: domains: Ensure genpd_debugfs_dir exists before remove
Date: Tue, 5 Jul 2022 12:38:37 +0200 [thread overview]
Message-ID: <YsQUrXfugKT1IV75@kroah.com> (raw)
In-Reply-To: <20220705094946.827697-1-hsinyi@chromium.org>
On Tue, Jul 05, 2022 at 05:49:47PM +0800, Hsin-Yi Wang wrote:
> genpd_debug_remove() may be indirectly called from others while
> genpd_debugfs_dir is not yet set. Make sure genpd_debugfs_dir exists
> before remove the sub components, otherwise components under
> /sys/kernel/debug may be accidentally removed.
>
> Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power domains")
> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> ---
> An example:
> scpsys_probe() in drivers/soc/mediatek/mtk-pm-domains.c indirectly calls
> genpd_debug_remove() on probe fail, causing /sys/kernel/debug/usb to be
> removed.
> ---
> drivers/base/power/domain.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 3e86772d5fac5..5a2e0232862e0 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -222,6 +222,9 @@ static void genpd_debug_remove(struct generic_pm_domain *genpd)
> {
> struct dentry *d;
>
> + if (!genpd_debugfs_dir)
> + return;
> +
> d = debugfs_lookup(genpd->name, genpd_debugfs_dir);
> debugfs_remove(d);
Why not just change this to be:
debugfs_remove(debugfs_lookup(genpd->name, debugfs_lookup("pm_genpd", NULL)));
thanks,
greg k-h
next prev parent reply other threads:[~2022-07-05 10:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-05 9:49 [PATCH] PM: domains: Ensure genpd_debugfs_dir exists before remove Hsin-Yi Wang
2022-07-05 10:38 ` Greg Kroah-Hartman [this message]
2022-07-05 11:06 ` Hsin-Yi Wang
2022-07-05 11:51 ` Greg Kroah-Hartman
2022-07-05 15:58 ` Hsin-Yi Wang
2022-07-05 16:26 ` Greg Kroah-Hartman
2022-07-05 17:27 ` Hsin-Yi Wang
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=YsQUrXfugKT1IV75@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=hsinyi@chromium.org \
--cc=khilman@kernel.org \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=treapking@chromium.org \
--cc=tstrudel@google.com \
--cc=ulf.hansson@linaro.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.