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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200624074015.GP2324254@vkoul-mobl>
Date:   Wed, 24 Jun 2020 13:10:15 +0530
From:   Vinod Koul <vkoul@...nel.org>
To:     Navid Emamdoost <navid.emamdoost@...il.com>
Cc:     Dan Williams <dan.j.williams@...el.com>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        dmaengine@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        emamd001@....edu, wu000273@....edu, kjlu@....edu, smccaman@....edu
Subject: Re: [PATCH] dmaengine: stm32-dmamux: fix pm_runtime_get_sync fialure
 cases

On 03-06-20, 14:36, Navid Emamdoost wrote:

s/fialure/failure

> Calling pm_runtime_get_sync increments the counter even in case of
> failure, causing incorrect ref count. Call pm_runtime_put_sync if
> pm_runtime_get_sync fails.
> 
> Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
> ---
>  drivers/dma/stm32-dmamux.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/stm32-dmamux.c b/drivers/dma/stm32-dmamux.c
> index 12f7637e13a1..ab250d7eed29 100644
> --- a/drivers/dma/stm32-dmamux.c
> +++ b/drivers/dma/stm32-dmamux.c
> @@ -140,6 +140,7 @@ static void *stm32_dmamux_route_allocate(struct of_phandle_args *dma_spec,
>  	ret = pm_runtime_get_sync(&pdev->dev);
>  	if (ret < 0) {
>  		spin_unlock_irqrestore(&dmamux->lock, flags);
> +		pm_runtime_put_sync(&pdev->dev);

why put_sync()

>  		goto error;
>  	}
>  	spin_unlock_irqrestore(&dmamux->lock, flags);
> @@ -340,8 +341,10 @@ static int stm32_dmamux_suspend(struct device *dev)
>  	int i, ret;
>  
>  	ret = pm_runtime_get_sync(dev);
> -	if (ret < 0)
> +	if (ret < 0) {
> +		pm_runtime_put_sync(dev);

here too

>  		return ret;
> +	}
>  
>  	for (i = 0; i < stm32_dmamux->dma_requests; i++)
>  		stm32_dmamux->ccr[i] = stm32_dmamux_read(stm32_dmamux->iomem,
> -- 
> 2.17.1

-- 
~Vinod

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ