lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gS1kdmFD=HWW+8qOhnd8N3c5mGEKVMzdk4-=_tAPx=JA@mail.gmail.com>
Date:   Thu, 14 Jul 2022 20:51:44 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Ulf Hansson <ulf.hansson@...aro.org>,
        Hsin-Yi Wang <hsinyi@...omium.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Kevin Hilman <khilman@...nel.org>, Pavel Machek <pavel@....cz>,
        Len Brown <len.brown@...el.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Pin-yen Lin <treapking@...omium.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] PM: domains: Ensure genpd_debugfs_dir exists before remove

On Wed, Jul 13, 2022 at 2:02 PM Ulf Hansson <ulf.hansson@...aro.org> wrote:
>
> On Tue, 5 Jul 2022 at 19:17, Hsin-Yi Wang <hsinyi@...omium.org> wrote:
> >
> > Both genpd_debug_add() and genpd_debug_remove() may be called
> > indirectly by other drivers while genpd_debugfs_dir is not yet
> > set. For example, drivers can call pm_genpd_init() in probe or
> > pm_genpd_init() in probe fail/cleanup path:
> >
> > pm_genpd_init()
> >  --> genpd_debug_add()
> >
> > pm_genpd_remove()
> >  --> genpd_remove()
> >    --> genpd_debug_remove()
> >
> > At this time, genpd_debug_init() may not yet be called.
> >
> > genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it
> > will return directly. Make sure this is also checked
> > in pm_genpd_remove(), otherwise components under debugfs root
> > which has the same name as other components under pm_genpd may
> > be accidentally removed, since NULL represents debugfs root.
> >
> > Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power domains")
> > Signed-off-by: Hsin-Yi Wang <hsinyi@...omium.org>
>
> Reviewed-by: Ulf Hansson <ulf.hansson@...aro.org>

Applied as 5.20 material, thanks!

> > ---
> > v1->v2: Add more context in commit message
> > ---
> >  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);
> >  }
> > --
> > 2.37.0.rc0.161.g10f37bed90-goog
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ