[PATCH v8 02/15] crypto: ti - Fix spinlock inconsistency in DTHEv2

From: T Pratham

Date: Thu Oct 01 2026 - 05:11:34 EST


Probe and remove functions use spin_(un)lock for acquiring the
dthe_dev_list.lock. But dthe_get_dev uses the bh variant. Change
spin_(un)lock to spin_(un)lock_bh to avoid potential deadlock when a
softIRQ process tries to acquire the already held lock.

Fixes: 52f641bc63a46 ("crypto: ti - Add driver for DTHE V2 AES Engine (ECB, CBC)")
Signed-off-by: T Pratham <t-pratham@xxxxxx>
---
drivers/crypto/ti/dthev2-common.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/crypto/ti/dthev2-common.c b/drivers/crypto/ti/dthev2-common.c
index cb4b8b38a5ec8..8f8c4a93af616 100644
--- a/drivers/crypto/ti/dthev2-common.c
+++ b/drivers/crypto/ti/dthev2-common.c
@@ -154,9 +154,9 @@ static int dthe_probe(struct platform_device *pdev)

platform_set_drvdata(pdev, dev_data);

- spin_lock(&dthe_dev_list.lock);
+ spin_lock_bh(&dthe_dev_list.lock);
list_add(&dev_data->list, &dthe_dev_list.dev_list);
- spin_unlock(&dthe_dev_list.lock);
+ spin_unlock_bh(&dthe_dev_list.lock);

ret = dthe_dma_init(dev_data);
if (ret)
@@ -189,9 +189,9 @@ static int dthe_probe(struct platform_device *pdev)
dma_release_channel(dev_data->dma_aes_tx);
dma_release_channel(dev_data->dma_sha_tx);
probe_dma_err:
- spin_lock(&dthe_dev_list.lock);
+ spin_lock_bh(&dthe_dev_list.lock);
list_del(&dev_data->list);
- spin_unlock(&dthe_dev_list.lock);
+ spin_unlock_bh(&dthe_dev_list.lock);

return ret;
}
@@ -200,9 +200,9 @@ static void dthe_remove(struct platform_device *pdev)
{
struct dthe_data *dev_data = platform_get_drvdata(pdev);

- spin_lock(&dthe_dev_list.lock);
+ spin_lock_bh(&dthe_dev_list.lock);
list_del(&dev_data->list);
- spin_unlock(&dthe_dev_list.lock);
+ spin_unlock_bh(&dthe_dev_list.lock);

dthe_unregister_algs();

--
2.34.1