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: <CAEkB2EREyXRS18Kq+6428MAJKtB3VoZdVqbJOODVJ7Pk9bzLLQ@mail.gmail.com>
Date:   Fri, 5 Jun 2020 01:13:35 -0500
From:   Navid Emamdoost <navid.emamdoost@...il.com>
To:     Jon Hunter <jonathanh@...dia.com>
Cc:     Laxman Dewangan <ldewangan@...dia.com>,
        Mark Brown <broonie@...nel.org>,
        Thierry Reding <thierry.reding@...il.com>,
        linux-spi@...r.kernel.org, linux-tegra@...r.kernel.org,
        LKML <linux-kernel@...r.kernel.org>,
        Navid Emamdoost <emamd001@....edu>,
        Qiushi Wu <wu000273@....edu>, Kangjie Lu <kjlu@....edu>,
        mccamant@...umn.edu
Subject: Re: [PATCH] spi: tegra114: missing put on pm_runtime_get_sync failure

On Fri, Jun 5, 2020 at 1:09 AM Jon Hunter <jonathanh@...dia.com> wrote:
>
>
> On 02/06/2020 05:55, Navid Emamdoost wrote:
> > the call to pm_runtime_get_sync increments the counter even
> > in case of failure leading to incorrect ref count.
> > Call pm_runtime_put if pm_runtime_get_sync fails.
> >
> > Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> > ---
> >  drivers/spi/spi-tegra114.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
> > index 83edabdb41ad..dccd2ac1a975 100644
> > --- a/drivers/spi/spi-tegra114.c
> > +++ b/drivers/spi/spi-tegra114.c
> > @@ -974,6 +974,7 @@ static int tegra_spi_setup(struct spi_device *spi)
> >               dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret);
> >               if (cdata)
> >                       tegra_spi_cleanup(spi);
> > +             pm_runtime_put(tspi->dev);
> >               return ret;
> >       }
> >
> > @@ -1398,6 +1399,7 @@ static int tegra_spi_probe(struct platform_device *pdev)
> >       ret = pm_runtime_get_sync(&pdev->dev);
> >       if (ret < 0) {
> >               dev_err(&pdev->dev, "pm runtime get failed, e = %d\n", ret);
> > +             pm_runtime_put(&pdev->dev);
> >               goto exit_pm_disable;
> >       }
>
> I am wondering if it is better we use put_sync() here to ensure that
> this happens before we exit the probe.

To be honest I am not sure when to use different flavors of
pm_runtime_put (like pm_runtime_put_noidle,
pm_runtime_put_autosuspend, pm_runtime_put_sync, pm_runtime_put,
pm_runtime_put_sync_suspend). I'd appreciate it if you could give me a
pointer on how to decide on this.

>
> Jon
>
> --
> nvpublic



-- 
Navid.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ