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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 19 Dec 2018 09:03:31 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Stephen Boyd <sboyd@...nel.org>
Cc:     Michael Turquette <mturquette@...libre.com>,
        Russell King <linux@...linux.org.uk>,
        linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Antoine Tenart <antoine.tenart@...tlin.com>,
        Maxime Chevallier <maxime.chevallier@...tlin.com>,
        Gregory Clement <gregory.clement@...tlin.com>,
        Nadav Haklai <nadavh@...vell.com>
Subject: Re: [PATCH v3 1/4] clk: core: clarify the check for runtime PM

Hi Stephen,

Stephen Boyd <sboyd@...nel.org> wrote on Tue, 18 Dec 2018 16:03:29
-0800:

> Quoting Miquel Raynal (2018-12-04 11:24:37)
> > Currently, the core->dev entry is populated only if runtime PM is
> > enabled. Doing so prevents accessing the device structure in any
> > case.
> > 
> > Keep the same logic but instead of using the presence of core->dev as
> > the only condition, also check the status of
> > pm_runtime_enabled(). Then, we can set the core->dev pointer at any
> > time as long as a device structure is available.
> > 
> > This change will help supporting device links in the clock subsystem.
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@...tlin.com>
> > ---
> >  drivers/clk/clk.c | 11 +++++------
> >  1 file changed, 5 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index af011974d4ec..b799347c5fd6 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -97,7 +97,7 @@ static int clk_pm_runtime_get(struct clk_core *core)
> >  {
> >         int ret = 0;
> >  
> > -       if (!core->dev)
> > +       if (!core->dev || !pm_runtime_enabled(core->dev))  
> 
> This looks potentially dangerous. What if runtime PM is disabled for the
> clk when this function is called? Shouldn't we just stash a bool away in
> the clk_core structure when it's registered? And then we can replace the
> check for !core->dev with a check for 'core->rpm_enabled' instead. That
> would be a more exact transformation.

Sure, I'll do that if you think there is a danger.


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ