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]
Message-ID: <CAJZ5v0iK+ASbadEjj+9vgCV+1ycjp8Hs2GbEmT3dGSqjLVGbPA@mail.gmail.com>
Date:   Wed, 26 Dec 2018 10:37:54 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     kjlu@....edu
Cc:     pakki001@....edu, "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Pavel Machek <pavel@....cz>, Len Brown <len.brown@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux PM <linux-pm@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] base: fix a missing check of clk_prepare

On Wed, Dec 26, 2018 at 3:47 AM Kangjie Lu <kjlu@....edu> wrote:
>
> clk_prepare() could fail, so let's check its status, and if it fails,
> issue an error message.
>
> Signed-off-by: Kangjie Lu <kjlu@....edu>
> ---
>  drivers/base/power/clock_ops.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
> index 5a42ae4078c2..cb6144fb24e2 100644
> --- a/drivers/base/power/clock_ops.c
> +++ b/drivers/base/power/clock_ops.c
> @@ -65,7 +65,9 @@ static void pm_clk_acquire(struct device *dev, struct pm_clock_entry *ce)
>         if (IS_ERR(ce->clk)) {
>                 ce->status = PCE_STATUS_ERROR;
>         } else {
> -               clk_prepare(ce->clk);
> +               if (clk_prepare(ce->clk))
> +                       dev_err(dev, "clk_prepare failed.\n");

I'm not sure that this is useful.  The code continues regardless of
the error anyway and it should at least set ce->status to
PCE_STATUS_ERROR in the failing case.

Have you seen a failure in this particular spot in practice?

> +
>                 ce->status = PCE_STATUS_ACQUIRED;
>                 dev_dbg(dev, "Clock %pC con_id %s managed by runtime PM.\n",
>                         ce->clk, ce->con_id);
> --
> 2.17.2 (Apple Git-113)
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ