[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZXKVzGnviCY5Hb6+@gondor.apana.org.au>
Date: Fri, 8 Dec 2023 12:04:28 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Dinghao Liu <dinghao.liu@....edu.cn>
Cc: Tom Lendacky <thomas.lendacky@....com>,
John Allen <john.allen@....com>,
"David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] [v2] crypto: ccp - fix memleak in ccp_init_dm_workarea
On Mon, Nov 27, 2023 at 11:47:10AM +0800, Dinghao Liu wrote:
> When dma_map_single() fails, wa->address is supposed to be freed
> by the callers of ccp_init_dm_workarea() through ccp_dm_free().
> However, many of the call spots don't expect to have to call
> ccp_dm_free() on failure of ccp_init_dm_workarea(), which may
> lead to a memleak. Let's free wa->address in ccp_init_dm_workarea()
> when dma_map_single() fails.
>
> Fixes: 63b945091a07 ("crypto: ccp - CCP device driver and interface support")
> Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
> ---
>
> Changelog:
>
> v2: -Improve the commit message.
> -Set wa->address to NULL after kfree() to prevent double-free.
> ---
> drivers/crypto/ccp/ccp-ops.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists