FAILED: patch "[PATCH] crypto: omap-des - fix crypto engine cleanup" failed to apply to 6.1-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 5d69ed4cd4f9c68ff9a6ebb2e8a1079223a4ec6e
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 5d69ed4cd4f9c68ff9a6ebb2e8a1079223a4ec6e Mon Sep 17 00:00:00 2001
From: Guangshuo Li <[email protected]>
Date: Sat, 12 Sep 2026 22:41:16 +0800
Subject: [PATCH] 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.
--- drivers/crypto/omap-des.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/omap-des.c +2 -0
@@ -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.53.0
Sasha Levin
maintainerPATCH 1/5 crypto: omap - Remove prepare/unprepare request
From: Herbert Xu <[email protected]>
[ Upstream commit c752c01389673b76c479d53cdd8f37558a0e406b ]
The callbacks for prepare and unprepare request in crypto_engine is superfluous. They can be done directly from do_one_request.
Move the code into do_one_request and remove the unused callbacks.
Stable-dep-of: 5d69ed4cd4f9 ("crypto: omap-des - fix crypto engine cleanup")
--- drivers/crypto/omap-aes-gcm.c | 14 +++++++------- drivers/crypto/omap-aes.c | 19 ++++--------------- drivers/crypto/omap-des.c | 19 ++++--------------- drivers/crypto/omap-sham.c | 6 ++++-- 4 files changed, 19 insertions(+), 39 deletions(-)
drivers/crypto/omap-aes-gcm.c +7 -7
@@ -212,12 +212,10 @@ static int omap_aes_gcm_handle_queue(struct omap_aes_dev *dd,return 0 ; } -static int omap_aes_gcm_prepare_req (struct crypto_engine *engine,void *areq) +static int omap_aes_gcm_prepare_req (struct aead_request *req, +struct omap_aes_dev *dd) { - struct aead_request *req = container_of(areq, struct aead_request, - base);struct omap_aes_reqctx *rctx =aead_request_ctx (req); -struct omap_aes_dev *dd = rctx->dd;struct omap_aes_gcm_ctx *ctx =crypto_aead_ctx (crypto_aead_reqtfm (req));int err;
@@ -362,11 +360,15 @@ static int omap_aes_gcm_crypt_req(struct crypto_engine *engine, void *areq) base);struct omap_aes_reqctx *rctx =aead_request_ctx (req);struct omap_aes_dev *dd = rctx->dd; -int ret =0 ; +int ret;if (!dd)return -ENODEV ; + ret =omap_aes_gcm_prepare_req (req, dd); +if (ret) +return ret; +if (dd->in_sg_len) ret =omap_aes_crypt_dma_start (dd);else
@@ -379,8 +381,6 @@ int omap_aes_gcm_cra_init(struct crypto_aead *tfm) {struct omap_aes_ctx *ctx =crypto_aead_ctx (tfm); - ctx->enginectx.op.prepare_request = omap_aes_gcm_prepare_req; - ctx->enginectx.op.unprepare_request =NULL ; ctx->enginectx.op.do_one_request = omap_aes_gcm_crypt_req;crypto_aead_set_reqsize (tfm,sizeof (struct omap_aes_reqctx ));
drivers/crypto/omap-aes.c +4 -15
@@ -426,20 +426,15 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd,return 0 ; } -static int omap_aes_prepare_req (struct crypto_engine *engine, -void *areq) +static int omap_aes_prepare_req (struct skcipher_request *req, +struct omap_aes_dev *dd) { - struct skcipher_request *req = container_of(areq, struct skcipher_request, base);struct omap_aes_ctx *ctx =crypto_skcipher_ctx (crypto_skcipher_reqtfm (req));struct omap_aes_reqctx *rctx =skcipher_request_ctx (req); -struct omap_aes_dev *dd = rctx->dd;int ret;u16 flags; -if (!dd) -return -ENODEV ; -/* assign new request to device */ dd->req = req; dd->total = req->cryptlen;
@@ -491,7 +486,8 @@ static int omap_aes_crypt_req(struct crypto_engine *engine,if (!dd)return -ENODEV ; -return omap_aes_crypt_dma_start (dd); +return omap_aes_prepare_req (req, dd) ?: +omap_aes_crypt_dma_start (dd); }static void omap_aes_copy_ivout (struct omap_aes_dev *dd,u8 *ivbuf)
@@ -629,11 +625,6 @@ static int omap_aes_ctr_decrypt(struct skcipher_request *req)return omap_aes_crypt (req,FLAGS_CTR ); } -static int omap_aes_prepare_req (struct crypto_engine *engine, -void *req); -static int omap_aes_crypt_req (struct crypto_engine *engine, -void *req); -static int omap_aes_init_tfm (struct crypto_skcipher *tfm) {const char *name =crypto_tfm_alg_name (&tfm->base);
@@ -649,8 +640,6 @@ static int omap_aes_init_tfm(struct crypto_skcipher *tfm)crypto_skcipher_set_reqsize (tfm,sizeof (struct omap_aes_reqctx ) +crypto_skcipher_reqsize (blk)); - ctx->enginectx.op.prepare_request = omap_aes_prepare_req; - ctx->enginectx.op.unprepare_request =NULL ; ctx->enginectx.op.do_one_request = omap_aes_crypt_req;return 0 ;
drivers/crypto/omap-des.c +4 -15
@@ -522,20 +522,15 @@ static int omap_des_handle_queue(struct omap_des_dev *dd,return 0 ; } -static int omap_des_prepare_req (struct crypto_engine *engine, -void *areq) +static int omap_des_prepare_req (struct skcipher_request *req, +struct omap_des_dev *dd) { - struct skcipher_request *req = container_of(areq, struct skcipher_request, base);struct omap_des_ctx *ctx =crypto_skcipher_ctx (crypto_skcipher_reqtfm (req)); -struct omap_des_dev *dd =omap_des_find_dev (ctx);struct omap_des_reqctx *rctx;int ret;u16 flags; -if (!dd) -return -ENODEV ; -/* assign new request to device */ dd->req = req; dd->total = req->cryptlen;
@@ -590,7 +585,8 @@ static int omap_des_crypt_req(struct crypto_engine *engine,if (!dd)return -ENODEV ; -return omap_des_crypt_dma_start (dd); +return omap_des_prepare_req (req, dd) ?: +omap_des_crypt_dma_start (dd); }static void omap_des_done_task (unsigned long data)
@@ -709,11 +705,6 @@ static int omap_des_cbc_decrypt(struct skcipher_request *req)return omap_des_crypt (req,FLAGS_CBC ); } -static int omap_des_prepare_req (struct crypto_engine *engine, -void *areq); -static int omap_des_crypt_req (struct crypto_engine *engine, -void *areq); -static int omap_des_init_tfm (struct crypto_skcipher *tfm) {struct omap_des_ctx *ctx =crypto_skcipher_ctx (tfm);
@@ -722,8 +713,6 @@ static int omap_des_init_tfm(struct crypto_skcipher *tfm)crypto_skcipher_set_reqsize (tfm,sizeof (struct omap_des_reqctx )); - ctx->enginectx.op.prepare_request = omap_des_prepare_req; - ctx->enginectx.op.unprepare_request =NULL ; ctx->enginectx.op.do_one_request = omap_des_crypt_req;return 0 ;
drivers/crypto/omap-sham.c +4 -2
@@ -1074,6 +1074,10 @@ static int omap_sham_hash_one_req(struct crypto_engine *engine, void *areq)dev_dbg (dd->dev,"hash-one: op: %u, total: %u, digcnt: %zd, final: %d" , ctx->op, ctx->total, ctx->digcnt, final); + err =omap_sham_prepare_request (engine, areq); +if (err) +return err; + err =pm_runtime_resume_and_get (dd->dev);if (err <0 ) {dev_err (dd->dev,"failed to get sync: %d\n" , err);
@@ -1350,8 +1354,6 @@ static int omap_sham_cra_init_alg(struct crypto_tfm *tfm, const char *alg_base) } tctx->enginectx.op.do_one_request = omap_sham_hash_one_req; - tctx->enginectx.op.prepare_request = omap_sham_prepare_request; - tctx->enginectx.op.unprepare_request =NULL ;return 0 ; }
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/5 crypto: omap - Include internal/engine.h
From: Herbert Xu <[email protected]>
[ Upstream commit b7b23ccbda5d956a8f605da35685ff5f53c0f3b9 ]
Inlucde internal/engine.h because this driver uses directly accesses attributes inside struct crypto_engine.
Stable-dep-of: 5d69ed4cd4f9 ("crypto: omap-des - fix crypto engine cleanup")
--- drivers/crypto/omap-aes.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-)
drivers/crypto/omap-aes.c +14 -16
@@ -13,28 +13,26 @@#define prn (num) pr_debug(#num "=%d\n", num)#define prx (num) pr_debug(#num "=%x\n", num) +#include <crypto/aes.h> +#include <crypto/gcm.h> +#include <crypto/internal/aead.h> +#include <crypto/internal/engine.h> +#include <crypto/internal/skcipher.h> +#include <crypto/scatterwalk.h> +#include <linux/dma-mapping.h> +#include <linux/dmaengine.h> #include <linux/err.h> -#include <linux/module.h> #include <linux/init.h> -#include <linux/errno.h> +#include <linux/interrupt.h> +#include <linux/io.h> #include <linux/kernel.h> -#include <linux/platform_device.h> -#include <linux/scatterlist.h> -#include <linux/dma-mapping.h> -#include <linux/dmaengine.h> -#include <linux/pm_runtime.h> +#include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> #include <linux/of_address.h> -#include <linux/io.h> -#include <linux/crypto.h> -#include <linux/interrupt.h> -#include <crypto/scatterwalk.h> -#include <crypto/aes.h> -#include <crypto/gcm.h> -#include <crypto/engine.h> -#include <crypto/internal/skcipher.h> -#include <crypto/internal/aead.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> +#include <linux/scatterlist.h> #include "omap-crypto.h" #include "omap-aes.h"
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/5 crypto: omap - Use new crypto_engine_op interface
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit 03906fba750ed468b8ea3484afc650454ce45bcc ]
Use the new crypto_engine_op interface where the callback is stored in the algorithm object.
Stable-dep-of: 5d69ed4cd4f9 ("crypto: omap-des - fix crypto engine cleanup")
--- drivers/crypto/omap-aes-gcm.c | 23 ++- drivers/crypto/omap-aes.c | 216 ++++++++++++++------------- drivers/crypto/omap-aes.h | 15 +- drivers/crypto/omap-des.c | 187 ++++++++++++----------- drivers/crypto/omap-sham.c | 274 +++++++++++++++++----------------- 5 files changed, 370 insertions(+), 345 deletions(-)
drivers/crypto/omap-aes-gcm.c +11 -12
@@ -7,18 +7,21 @@* Copyright (c) 2016 Texas Instruments Incorporated */ +#include <crypto/aes.h> +#include <crypto/engine.h> +#include <crypto/gcm.h> +#include <crypto/internal/aead.h> +#include <crypto/scatterwalk.h> +#include <crypto/skcipher.h> #include <linux/errno.h> -#include <linux/scatterlist.h> #include <linux/dma-mapping.h> #include <linux/dmaengine.h> -#include <linux/omap-dma.h> #include <linux/interrupt.h> +#include <linux/kernel.h> +#include <linux/omap-dma.h> #include <linux/pm_runtime.h> -#include <crypto/aes.h> -#include <crypto/gcm.h> -#include <crypto/scatterwalk.h> -#include <crypto/skcipher.h> -#include <crypto/internal/aead.h> +#include <linux/scatterlist.h> +#include <linux/string.h> #include "omap-crypto.h" #include "omap-aes.h"
@@ -354,7 +357,7 @@ int omap_aes_4106gcm_setauthsize(struct crypto_aead *parent,return crypto_rfc4106_check_authsize (authsize); } -static int omap_aes_gcm_crypt_req (struct crypto_engine *engine,void *areq) +int omap_aes_gcm_crypt_req (struct crypto_engine *engine,void *areq) { struct aead_request *req = container_of(areq, struct aead_request, base);
@@ -379,10 +382,6 @@ static int omap_aes_gcm_crypt_req(struct crypto_engine *engine, void *areq)int omap_aes_gcm_cra_init (struct crypto_aead *tfm) { -struct omap_aes_ctx *ctx =crypto_aead_ctx (tfm); - - ctx->enginectx.op.do_one_request = omap_aes_gcm_crypt_req; -crypto_aead_set_reqsize (tfm,sizeof (struct omap_aes_reqctx ));return 0 ;
drivers/crypto/omap-aes.c +115 -101
302 lines not on this page · raw message
drivers/crypto/omap-aes.h +7 -8
@@ -10,7 +10,6 @@#define __OMAP_AES_H__#include <crypto/aes.h> -#include <crypto/engine.h> #define DST_MAXBURST 4#define DMA_MIN (DST_MAXBURST * sizeof(u32))
@@ -93,7 +92,6 @@ struct omap_aes_gcm_result { };struct omap_aes_ctx { -struct crypto_engine_ctx enginectx;int keylen;u32 key[AES_KEYSIZE_256 /sizeof (u32)];u8 nonce[4 ];
@@ -117,15 +115,15 @@ struct omap_aes_reqctx {#define OMAP_AES_CACHE_SIZE 0struct omap_aes_algs_info { -struct skcipher_alg *algs_list; -unsigned int size; -unsigned int registered; +struct skcipher_engine_alg *algs_list; +unsigned int size; +unsigned int registered; };struct omap_aes_aead_algs { -struct aead_alg *algs_list; -unsigned int size; -unsigned int registered; +struct aead_engine_alg *algs_list; +unsigned int size; +unsigned int registered; };struct omap_aes_pdata {
@@ -218,5 +216,6 @@ int omap_aes_crypt_dma_start(struct omap_aes_dev *dd);int omap_aes_crypt_dma_stop (struct omap_aes_dev *dd);void omap_aes_gcm_dma_out_callback (void *data);void omap_aes_clear_copy_flags (struct omap_aes_dev *dd); +int omap_aes_gcm_crypt_req (struct crypto_engine *engine,void *areq);#endif
drivers/crypto/omap-des.c +96 -91
258 lines not on this page · raw message
drivers/crypto/omap-sham.c +141 -133
436 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/5 crypto: omap - convert from tasklet to BH workqueue
In reply to Sasha LevinFrom: Ryo Takakura <[email protected]>
[ Upstream commit 381e8ee368234a51b3a4f231f6f24ff0b09d9f9e ]
tasklet has been marked deprecated and it's planned to be removed. Make omap crypto drivers to use BH workqueue which is the new interface for executing in BH context in place of tasklet.
Stable-dep-of: 5d69ed4cd4f9 ("crypto: omap-des - fix crypto engine cleanup")
--- drivers/crypto/omap-aes.c | 15 ++++++++------- drivers/crypto/omap-aes.h | 2 +- drivers/crypto/omap-des.c | 17 +++++++++-------- drivers/crypto/omap-sham.c | 15 ++++++++------- 4 files changed, 26 insertions(+), 23 deletions(-)
drivers/crypto/omap-aes.c +8 -7
@@ -34,6 +34,7 @@#include <linux/pm_runtime.h> #include <linux/scatterlist.h> #include <linux/string.h> +#include <linux/workqueue.h> #include "omap-crypto.h" #include "omap-aes.h"
@@ -223,7 +224,7 @@ static void omap_aes_dma_out_callback(void *data)struct omap_aes_dev *dd = data;/* dma_lch_out - completed */ -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task); }static int omap_aes_dma_init (struct omap_aes_dev *dd)
@@ -497,9 +498,9 @@ static void omap_aes_copy_ivout(struct omap_aes_dev *dd, u8 *ivbuf) ((u32 *)ivbuf)[i] =omap_aes_read (dd,AES_REG_IV (dd, i)); } -static void omap_aes_done_task (unsigned long data) +static void omap_aes_done_task (struct work_struct *t) { -struct omap_aes_dev *dd = (struct omap_aes_dev *)data; +struct omap_aes_dev *dd =from_work (dd, t, done_task);pr_debug ("enter done_task\n" );
@@ -933,7 +934,7 @@ static irqreturn_t omap_aes_irq(int irq, void *dev_id)if (!dd->total)/* All bytes read! */ -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task);else /* Enable DATA_IN interrupt for next block */ omap_aes_write (dd,AES_REG_IRQ_ENABLE (dd),0x2 );
@@ -1151,7 +1152,7 @@ static int omap_aes_probe(struct platform_device *pdev) (reg & dd->pdata->major_mask) >> dd->pdata->major_shift, (reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift); -tasklet_init (&dd->done_task, omap_aes_done_task, (unsigned long )dd); +INIT_WORK (&dd->done_task, omap_aes_done_task); err =omap_aes_dma_init (dd);if (err == -EPROBE_DEFER ) {
@@ -1246,7 +1247,7 @@ static int omap_aes_probe(struct platform_device *pdev)omap_aes_dma_cleanup (dd); err_irq: -tasklet_kill (&dd->done_task); +cancel_work_sync (&dd->done_task); err_pm_disable:pm_runtime_disable (dev); err_res:
@@ -1281,7 +1282,7 @@ static int omap_aes_remove(struct platform_device *pdev)crypto_engine_exit (dd->engine); -tasklet_kill (&dd->done_task); +cancel_work_sync (&dd->done_task);omap_aes_dma_cleanup (dd);pm_runtime_disable (dd->dev);
drivers/crypto/omap-aes.h +1 -1
@@ -161,7 +161,7 @@ struct omap_aes_dev {unsigned long flags;int err; -struct tasklet_struct done_task; +struct work_struct done_task;struct aead_queue aead_queue;spinlock_t lock;
drivers/crypto/omap-des.c +9 -8
@@ -35,6 +35,7 @@#include <linux/pm_runtime.h> #include <linux/scatterlist.h> #include <linux/string.h> +#include <linux/workqueue.h> #include "omap-crypto.h"
@@ -135,7 +136,7 @@ struct omap_des_dev {unsigned long flags;int err; -struct tasklet_struct done_task; +struct work_struct done_task;struct skcipher_request *req;struct crypto_engine *engine;
@@ -330,7 +331,7 @@ static void omap_des_dma_out_callback(void *data)struct omap_des_dev *dd = data;/* dma_lch_out - completed */ -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task); }static int omap_des_dma_init (struct omap_des_dev *dd)
@@ -586,9 +587,9 @@ static int omap_des_crypt_req(struct crypto_engine *engine,omap_des_crypt_dma_start (dd); } -static void omap_des_done_task (unsigned long data) +static void omap_des_done_task (struct work_struct *t) { -struct omap_des_dev *dd = (struct omap_des_dev *)data; +struct omap_des_dev *dd =from_work (dd, t, done_task);int i;pr_debug ("enter done_task\n" );
@@ -901,7 +902,7 @@ static irqreturn_t omap_des_irq(int irq, void *dev_id)if (!dd->total)/* All bytes read! */ -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task);else /* Enable DATA_IN interrupt for next block */ omap_des_write (dd,DES_REG_IRQ_ENABLE (dd),0x2 );
@@ -1003,7 +1004,7 @@ static int omap_des_probe(struct platform_device *pdev) (reg & dd->pdata->major_mask) >> dd->pdata->major_shift, (reg & dd->pdata->minor_mask) >> dd->pdata->minor_shift); -tasklet_init (&dd->done_task, omap_des_done_task, (unsigned long )dd); +INIT_WORK (&dd->done_task, omap_des_done_task); err =omap_des_dma_init (dd);if (err == -EPROBE_DEFER ) {
@@ -1070,7 +1071,7 @@ static int omap_des_probe(struct platform_device *pdev)omap_des_dma_cleanup (dd); err_irq: -tasklet_kill (&dd->done_task); +cancel_work_sync (&dd->done_task); err_get:pm_runtime_disable (dev); err_res:
@@ -1094,7 +1095,7 @@ static int omap_des_remove(struct platform_device *pdev)crypto_engine_unregister_skcipher ( &dd->pdata->algs_info[i].algs_list[j]); -tasklet_kill (&dd->done_task); +cancel_work_sync (&dd->done_task);omap_des_dma_cleanup (dd);pm_runtime_disable (dd->dev);
drivers/crypto/omap-sham.c +8 -7
@@ -38,6 +38,7 @@#include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/string.h> +#include <linux/workqueue.h> #define MD5_DIGEST_SIZE 16
@@ -218,7 +219,7 @@ struct omap_sham_dev {int irq;int err;struct dma_chan *dma_lch; -struct tasklet_struct done_task; +struct work_struct done_task;u8 polling_mode; u8 xmit_buf[BUFLEN] OMAP_ALIGNED;
@@ -562,7 +563,7 @@ static void omap_sham_dma_callback(void *param)struct omap_sham_dev *dd = param;set_bit (FLAGS_DMA_READY , &dd->flags); -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task); } static int omap_sham_xmit_dma(struct omap_sham_dev *dd, size_t length,
@@ -1717,9 +1718,9 @@ static struct ahash_engine_alg algs_sha384_sha512[] = { }, }; -static void omap_sham_done_task (unsigned long data) +static void omap_sham_done_task (struct work_struct *t) { -struct omap_sham_dev *dd = (struct omap_sham_dev *)data; +struct omap_sham_dev *dd =from_work (dd, t, done_task);int err =0 ;dev_dbg (dd->dev,"%s: flags=%lx\n" , __func__, dd->flags);
@@ -1753,7 +1754,7 @@ static void omap_sham_done_task(unsigned long data)static irqreturn_t omap_sham_irq_common (struct omap_sham_dev *dd) {set_bit (FLAGS_OUTPUT_READY , &dd->flags); -tasklet_schedule (&dd->done_task); +queue_work (system_bh_wq, &dd->done_task);return IRQ_HANDLED ; }
@@ -2076,7 +2077,7 @@ static int omap_sham_probe(struct platform_device *pdev)platform_set_drvdata (pdev, dd);INIT_LIST_HEAD (&dd->list); -tasklet_init (&dd->done_task, omap_sham_done_task, (unsigned long )dd); +INIT_WORK (&dd->done_task, omap_sham_done_task);crypto_init_queue (&dd->queue,OMAP_SHAM_QUEUE_LENGTH ); err = (dev->of_node) ? omap_sham_get_res_of(dd, dev, &res) :
@@ -2217,7 +2218,7 @@ static int omap_sham_remove(struct platform_device *pdev) &dd->pdata->algs_info[i].algs_list[j]); dd->pdata->algs_info[i].registered--; } -tasklet_kill (&dd->done_task); +cancel_work_sync (&dd->done_task);pm_runtime_dont_use_autosuspend (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/5 crypto: omap-des - fix crypto engine cleanup
In reply to Sasha LevinFrom: Guangshuo Li <[email protected]>
[ Upstream commit 5d69ed4cd4f9c68ff9a6ebb2e8a1079223a4ec6e ]
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.
--- drivers/crypto/omap-des.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/omap-des.c +2 -0
@@ -1095,6 +1095,8 @@ static int omap_des_remove(struct platform_device *pdev)crypto_engine_unregister_skcipher ( &dd->pdata->algs_info[i].algs_list[j]); +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.53.0