* [PATCH] crypto: aspeed - fix double free caused by devm
@ 2025-10-20 10:11 Haotian Zhang
2025-10-23 4:59 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Haotian Zhang @ 2025-10-20 10:11 UTC (permalink / raw)
To: neal_liu, herbert, davem
Cc: joel, andrew, linux-aspeed, linux-crypto, linux-arm-kernel,
linux-kernel, Haotian Zhang
The clock obtained via devm_clk_get_enabled() is automatically managed
by devres and will be disabled and freed on driver detach. Manually
calling clk_disable_unprepare() in error path and remove function
causes double free.
Remove the manual clock cleanup in both aspeed_acry_probe()'s error
path and aspeed_acry_remove().
Fixes: 2f1cf4e50c95 ("crypto: aspeed - Add ACRY RSA driver")
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
drivers/crypto/aspeed/aspeed-acry.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/crypto/aspeed/aspeed-acry.c b/drivers/crypto/aspeed/aspeed-acry.c
index 8d1c79aaca07..5993bcba9716 100644
--- a/drivers/crypto/aspeed/aspeed-acry.c
+++ b/drivers/crypto/aspeed/aspeed-acry.c
@@ -787,7 +787,6 @@ static int aspeed_acry_probe(struct platform_device *pdev)
err_engine_rsa_start:
crypto_engine_exit(acry_dev->crypt_engine_rsa);
clk_exit:
- clk_disable_unprepare(acry_dev->clk);
return rc;
}
@@ -799,7 +798,6 @@ static void aspeed_acry_remove(struct platform_device *pdev)
aspeed_acry_unregister(acry_dev);
crypto_engine_exit(acry_dev->crypt_engine_rsa);
tasklet_kill(&acry_dev->done_task);
- clk_disable_unprepare(acry_dev->clk);
}
MODULE_DEVICE_TABLE(of, aspeed_acry_of_matches);
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: aspeed - fix double free caused by devm
2025-10-20 10:11 [PATCH] crypto: aspeed - fix double free caused by devm Haotian Zhang
@ 2025-10-23 4:59 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2025-10-23 4:59 UTC (permalink / raw)
To: Haotian Zhang
Cc: neal_liu, davem, joel, andrew, linux-aspeed, linux-crypto,
linux-arm-kernel, linux-kernel
On Mon, Oct 20, 2025 at 06:11:09PM +0800, Haotian Zhang wrote:
> The clock obtained via devm_clk_get_enabled() is automatically managed
> by devres and will be disabled and freed on driver detach. Manually
> calling clk_disable_unprepare() in error path and remove function
> causes double free.
>
> Remove the manual clock cleanup in both aspeed_acry_probe()'s error
> path and aspeed_acry_remove().
>
> Fixes: 2f1cf4e50c95 ("crypto: aspeed - Add ACRY RSA driver")
> Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
> ---
> drivers/crypto/aspeed/aspeed-acry.c | 2 --
> 1 file changed, 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-23 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-20 10:11 [PATCH] crypto: aspeed - fix double free caused by devm Haotian Zhang
2025-10-23 4:59 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®