FAILED: patch "[PATCH] crypto: omap-des - fix crypto engine cleanup" failed to apply to 6.12-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 6.12-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.12.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.12.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/2 crypto: omap - convert from tasklet to BH workqueue
From: 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
@@ -33,6 +33,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"
@@ -222,7 +223,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)
@@ -496,9 +497,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" );
@@ -932,7 +933,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 );
@@ -1150,7 +1151,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 ) {
@@ -1245,7 +1246,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:
@@ -1280,7 +1281,7 @@ static void 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
@@ -33,6 +33,7 @@#include <linux/pm_runtime.h> #include <linux/scatterlist.h> #include <linux/string.h> +#include <linux/workqueue.h> #include "omap-crypto.h"
@@ -133,7 +134,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;
@@ -328,7 +329,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)
@@ -584,9 +585,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" );
@@ -899,7 +900,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 );
@@ -1009,7 +1010,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 ) {
@@ -1072,7 +1073,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:
@@ -1092,7 +1093,7 @@ static void omap_des_remove(struct platform_device *pdev)omap_des_unregister_algs (dd->pdata); -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
@@ -37,6 +37,7 @@#include <linux/scatterlist.h> #include <linux/slab.h> #include <linux/string.h> +#include <linux/workqueue.h> #define MD5_DIGEST_SIZE 16
@@ -217,7 +218,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;
@@ -561,7 +562,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,
@@ -1704,9 +1705,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);
@@ -1740,7 +1741,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 ; }
@@ -2063,7 +2064,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) :
@@ -2204,7 +2205,7 @@ static void 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 2/2 crypto: omap-des - fix crypto engine cleanup
From: 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
@@ -1093,6 +1093,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