[PATCH] crypto: eip93 - Fix dma_unmap_single() direction in eip93_hash_handle_result()

From: Thomas Fourier

Date: Mon Mar 30 2026 - 05:27:37 EST


The buffer rctx->sa_record_base was mapped in eip93_hash_update();
rctx->sa_state_ctr_base and rctx->sa_state_base in eip93_send_req()
with direction DMA_TO_DEVICE but unmap with DMA_FROM_DEVICE in
eip93_hash_handle_result() and eip93_handle_result().

Change the unmap to match the mapping.

Fixes: 9739f5f93b78 ("crypto: eip93 - Add Inside Secure SafeXcel EIP-93 crypto engine support")
Cc: <stable@xxxxxxxxxxxxxxx>
Signed-off-by: Thomas Fourier <fourier.thomas@xxxxxxxxx>
---
drivers/crypto/inside-secure/eip93/eip93-common.c | 4 ++--
drivers/crypto/inside-secure/eip93/eip93-hash.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/inside-secure/eip93/eip93-common.c b/drivers/crypto/inside-secure/eip93/eip93-common.c
index f4ad6beff15e..75659a45ea5a 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-common.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-common.c
@@ -687,12 +687,12 @@ void eip93_handle_result(struct eip93_device *eip93, struct eip93_cipher_reqctx
if (rctx->sa_state_ctr)
dma_unmap_single(eip93->dev, rctx->sa_state_ctr_base,
sizeof(*rctx->sa_state_ctr),
- DMA_FROM_DEVICE);
+ DMA_TO_DEVICE);

if (rctx->sa_state)
dma_unmap_single(eip93->dev, rctx->sa_state_base,
sizeof(*rctx->sa_state),
- DMA_FROM_DEVICE);
+ DMA_TO_DEVICE);

if (!IS_ECB(rctx->flags))
memcpy(reqiv, rctx->sa_state->state_iv, rctx->ivsize);
diff --git a/drivers/crypto/inside-secure/eip93/eip93-hash.c b/drivers/crypto/inside-secure/eip93/eip93-hash.c
index 2705855475b2..19a41a0db667 100644
--- a/drivers/crypto/inside-secure/eip93/eip93-hash.c
+++ b/drivers/crypto/inside-secure/eip93/eip93-hash.c
@@ -67,7 +67,7 @@ void eip93_hash_handle_result(struct crypto_async_request *async, int err)
int i;

dma_unmap_single(eip93->dev, rctx->sa_state_base,
- sizeof(*sa_state), DMA_FROM_DEVICE);
+ sizeof(*sa_state), DMA_TO_DEVICE);

/*
* With partial_hash assume SHA256_DIGEST_SIZE buffer is passed.
--
2.43.0