Linux cryptographic layer development
 help / color / mirror / Atom feed
From: T Pratham <t-pratham@ti.com>
To: T Pratham <t-pratham@ti.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: 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: [PATCH v3 12/12] crypto: ti - Do AEAD software fallback on only ENOMEM
Date: Thu, 10 Sep 2026 16:12:02 +0530	[thread overview]
Message-ID: <20260910104202.1537226-13-t-pratham@ti.com> (raw)
In-Reply-To: <20260910104202.1537226-1-t-pratham@ti.com>

Similarly in how AES part of this driver, we are falling back to
software when memory allocation fails (we get -ENOMEM), fix the AEAD
part also to only do fallback when we fail only due to -ENOMEM. This is
because we are doing memory allocations with GFP_ATOMIC in the beginning
which might fail. Any other failure paths might have modified the data
or buffers already. Doing a software fallback on them might give
incorrect or corrupt results.

Fixes: 37b902c603042 ("crypto: ti - Add support for AES-GCM in DTHEv2 driver")
Signed-off-by: T Pratham <t-pratham@ti.com>
---
 drivers/crypto/ti/dthev2-aes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/ti/dthev2-aes.c b/drivers/crypto/ti/dthev2-aes.c
index a034c1c8f20ed..150ce65f613fa 100644
--- a/drivers/crypto/ti/dthev2-aes.c
+++ b/drivers/crypto/ti/dthev2-aes.c
@@ -1173,7 +1173,7 @@ static int dthe_aead_run(struct crypto_engine *engine, void *areq)
 aead_prep_aad_err:
 	memzero_explicit(rctx->padding, 3 * AES_BLOCK_SIZE);
 
-	if (ret)
+	if (ret == -ENOMEM)
 		ret = dthe_aead_do_fallback(req);
 
 	local_bh_disable();
-- 
2.34.1


      parent reply	other threads:[~2026-09-10 10:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 10:41 [PATCH v3 00/12] Fix several issues in DTHEv2 driver T Pratham
2026-09-10 10:41 ` [PATCH v3 01/12] crypto: ti - Use list_first_entry_or_null() in dthe_get_dev() T Pratham
2026-09-10 10:41 ` [PATCH v3 02/12] crypto: ti - Fix spinlock inconsistency in DTHEv2 T Pratham
2026-09-10 10:41 ` [PATCH v3 03/12] crypto: ti - Fix potential memory corruption on highmem pages T Pratham
2026-09-10 10:41 ` [PATCH v3 04/12] crypto: ti - Fix use-after-free of dev_data on DTHEv2 driver removal T Pratham
2026-09-10 10:41 ` [PATCH v3 05/12] crypto: ti - Trim scatterlists to correct length in AES T Pratham
2026-09-10 10:41 ` [PATCH v3 06/12] crypto: ti - Align buffers to cacheline for DMA T Pratham
2026-09-10 10:41 ` [PATCH v3 07/12] crypto: ti - Separate padding buffer for src and dst T Pratham
2026-09-10 10:41 ` [PATCH v3 08/12] crypto: ti - Validate sg_nents_for_len() return value in DTHEv2 AES T Pratham
2026-09-10 10:41 ` [PATCH v3 09/12] crypto: ti - Validate sg_nents_for_len() return value in DTHEv2 AEAD T Pratham
2026-09-10 10:42 ` [PATCH v3 10/12] crypto: ti - Terminate DMA on all error paths in AES to clear descriptors T Pratham
2026-09-10 10:42 ` [PATCH v3 11/12] crypto: ti - Terminate DMA on all error paths in AEAD " T Pratham
2026-09-10 10:42 ` T Pratham [this message]

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=20260910104202.1537226-13-t-pratham@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