From: T Pratham <t-pratham@ti.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
Sebin Francis <sebin.francis@ti.com>,
Manorit Chawdhry <m-chawdhry@ti.com>,
Vishal Mahaveer <vishalm@ti.com>,
Praneeth Bajjuri <praneeth@ti.com>,
<linux-crypto@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 02/15] crypto: ti - Fix spinlock inconsistency in DTHEv2
Date: Fri, 18 Sep 2026 15:45:33 +0530 [thread overview]
Message-ID: <dbcca43b-969d-4b43-9216-5790fc82d06c@ti.com> (raw)
In-Reply-To: <aqz_rKnEDvtobXXB@gondor.apana.org.au>
On 9/18/26 14:39, Herbert Xu wrote:
> On Thu, Sep 10, 2026 at 11:26:06PM +0530, T Pratham wrote:
>> 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_bh to spin_(un)lock 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@ti.com>
>> ---
>> drivers/crypto/ti/dthev2-common.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/crypto/ti/dthev2-common.c b/drivers/crypto/ti/dthev2-common.c
>> index cc02449382673..4c6b72ba104ec 100644
>> --- a/drivers/crypto/ti/dthev2-common.c
>> +++ b/drivers/crypto/ti/dthev2-common.c
>> @@ -39,11 +39,11 @@ struct dthe_data *dthe_get_dev(struct dthe_tfm_ctx *ctx)
>> if (ctx->dev_data)
>> return ctx->dev_data;
>>
>> - spin_lock_bh(&dthe_dev_list.lock);
>> + spin_lock(&dthe_dev_list.lock);
>
> This makes no sense. The only time you can use a plain spin lock
> is if all callers are from the same context, e.g., all with BH off
> or all with BH on.
>
> Because this function is called from the Crypto API, which allows
> mixed BH context, you cannot safely use spin_lock.
>
> In fact Sashiko reported this issue too:
>
> https://sashiko.dev/#/patchset/20260910175619.2122149-1-t-pratham%40ti.com
>
> Cheers,
Reading it carefully, looks like I messed up reading the Sashiko comment
the first time I read it on another patch. It makes much more sense now,
to not downgrade _bh to regular spinlock. Will fix and send.
--
Regards
T Pratham <t-pratham@ti.com>
next prev parent reply other threads:[~2026-09-18 10:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 17:56 [PATCH v4 00/15] Fix several issues in DTHEv2 driver T Pratham
2026-09-10 17:56 ` [PATCH v4 01/15] crypto: ti - Use list_first_entry_or_null() in dthe_get_dev() T Pratham
2026-09-10 17:56 ` [PATCH v4 02/15] crypto: ti - Fix spinlock inconsistency in DTHEv2 T Pratham
2026-09-18 9:09 ` Herbert Xu
2026-09-18 10:15 ` T Pratham [this message]
2026-09-10 17:56 ` [PATCH v4 03/15] crypto: ti - Fix potential memory corruption on highmem pages T Pratham
2026-09-10 17:56 ` [PATCH v4 04/15] crypto: ti - Fix use-after-free of dev_data on DTHEv2 driver removal T Pratham
2026-09-10 17:56 ` [PATCH v4 05/15] crypto: ti - Trim scatterlists to correct length in AES T Pratham
2026-09-10 17:56 ` [PATCH v4 06/15] crypto: ti - Align buffers to cacheline for DMA T Pratham
2026-09-10 17:56 ` [PATCH v4 07/15] crypto: ti - Separate padding buffer for src and dst T Pratham
2026-09-10 17:56 ` [PATCH v4 08/15] crypto: ti - Validate sg_nents_for_len() return value in DTHEv2 AES T Pratham
2026-09-10 17:56 ` [PATCH v4 09/15] crypto: ti - Validate sg_nents_for_len() return value in DTHEv2 AEAD T Pratham
2026-09-10 17:56 ` [PATCH v4 10/15] crypto: ti - Terminate DMA on all error paths in AES to clear descriptors T Pratham
2026-09-10 17:56 ` [PATCH v4 11/15] crypto: ti - Terminate DMA on all error paths in AEAD " T Pratham
2026-09-10 17:56 ` [PATCH v4 12/15] crypto: ti - Do AEAD software fallback on only ENOMEM T Pratham
2026-09-10 17:56 ` [PATCH v4 13/15] crypto: ti - Correct AEAD tag operations against dma cache invalidation T Pratham
2026-09-10 17:56 ` [PATCH v4 14/15] crypto: ti - Change lengths in AES to u64 to avoid potential overflows T Pratham
2026-09-10 17:56 ` [PATCH v4 15/15] crypto: ti - Change lengths in AEAD " T Pratham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbcca43b-969d-4b43-9216-5790fc82d06c@ti.com \
--to=t-pratham@ti.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m-chawdhry@ti.com \
--cc=praneeth@ti.com \
--cc=sebin.francis@ti.com \
--cc=vishalm@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®