Skip to contentSkip to conversation

crypto: omap-des: fix crypto engine cleanup

PATCH In review Guangshuo Li 2 participants 2 messages Sep 12 – Sep 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: omap-des: fix crypto engine cleanup

omap_des_probe() allocates and starts a crypto engine, but the remove path does not call the matching crypto_engine_exit(). The probe failure path already performs this cleanup.

crypto_engine_alloc_init() creates a kthread worker for processing requests. Without crypto_engine_exit() during driver removal, the worker is left running after the device is removed.

Call crypto_engine_exit() after unregistering the algorithms and before tearing down the remaining request handling resources. This stops the engine and destroys its worker.

This issue was found by manual code inspection.

Fixes f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
---
 drivers/crypto/omap-des.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/crypto/omap-des.c +2 -0
index 3b7104cb4487..4b5a8d13f505 100644
@@ -1082,6 +1082,8 @@ static void omap_des_remove(struct platform_device *pdev)
 
 	omap_des_unregister_algs(dd->pdata);
 
+	crypto_engine_exit(dd->engine);
+
 	cancel_work_sync(&dd->done_task);
 	omap_des_dma_cleanup(dd);
 	pm_runtime_disable(dd->dev);
Signature · 1 line
2.43.0
maintainer
#1 lore raw
Quoted 12 lines · Guangshuo Li

omap_des_probe() allocates and starts a crypto engine, but the remove path does not call the matching crypto_engine_exit(). The probe failure path already performs this cleanup.

crypto_engine_alloc_init() creates a kthread worker for processing requests. Without crypto_engine_exit() during driver removal, the worker is left running after the device is removed.

Call crypto_engine_exit() after unregistering the algorithms and before tearing down the remaining request handling resources. This stops the engine and destroys its worker.

Quoted 8 lines

This issue was found by manual code inspection.

Fixes f1b77aaca85a ("crypto: omap-des - Integrate with the crypto engine framework")
---
 drivers/crypto/omap-des.c | 2 ++
 1 file changed, 2 insertions(+)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt