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] [day] [month] [year] [list]
Date:   Wed, 4 Apr 2018 14:45:01 +0200
From:   Lars-Peter Clausen <lars@...afoo.de>
To:     Xidong Wang <wangxidong_97@....com>,
        Vinod Koul <vinod.koul@...el.com>,
        Dan Williams <dan.j.williams@...el.com>
Cc:     dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] dmaengine:jz4740:fix memory leak

On 04/04/2018 05:21 AM, Xidong Wang wrote:
> In function jz4740_dma_probe(), the memory allocated by
> clk_get() is not released on the error path that ret, which holds
> the return value of dma_async_device_register(), is not NULL.
> This will result in a memory leak bug.
> 
> Signed-off-by: Xidong Wang <wangxidong_97@....com>

Maybe use devm_clk_get() since the same clk_put() call is missing in the
remove callback.

> ---
>  drivers/dma/dma-jz4740.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c
> index afd5e10..082c158 100644
> --- a/drivers/dma/dma-jz4740.c
> +++ b/drivers/dma/dma-jz4740.c
> @@ -570,6 +570,7 @@ static int jz4740_dma_probe(struct platform_device *pdev)
>  	dma_async_device_unregister(dd);
>  err_clk:
>  	clk_disable_unprepare(dmadev->clk);
> +	clk_put(dmadev->clk);
>  	return ret;
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ