public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 1/3] crypto: sun8i-ce - fix nents passed to dma_unmap_sg()
@ 2025-05-19 15:13 Ovidiu Panait
  2025-05-19 15:13 ` [PATCH 2/3] crypto: sun8i-ce - remove ivlen field of sun8i_cipher_req_ctx Ovidiu Panait
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ovidiu Panait @ 2025-05-19 15:13 UTC (permalink / raw)
  To: clabbe.montjoie, herbert, davem, linux-crypto
  Cc: wens, jernej.skrabec, samuel, linux-arm-kernel, linux-sunxi,
	linux-kernel, Ovidiu Panait

In sun8i_ce_cipher_unprepare(), dma_unmap_sg() is incorrectly called with
the number of entries returned by dma_map_sg(), rather than using the
original number of entries passed when mapping the scatterlist.

To fix this, stash the original number of entries passed to dma_map_sg()
in the request context.

Fixes: 0605fa0f7826 ("crypto: sun8i-ce - split into prepare/run/unprepare")
Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@gmail.com>
---
 drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
index f9cf00d690e2..7cd3b13f3bdc 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c
@@ -278,8 +278,8 @@ static int sun8i_ce_cipher_prepare(struct crypto_engine *engine, void *async_req
 	}
 
 	chan->timeout = areq->cryptlen;
-	rctx->nr_sgs = nr_sgs;
-	rctx->nr_sgd = nr_sgd;
+	rctx->nr_sgs = ns;
+	rctx->nr_sgd = nd;
 	return 0;
 
 theend_sgs:
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-06-13  9:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 15:13 [PATCH 1/3] crypto: sun8i-ce - fix nents passed to dma_unmap_sg() Ovidiu Panait
2025-05-19 15:13 ` [PATCH 2/3] crypto: sun8i-ce - remove ivlen field of sun8i_cipher_req_ctx Ovidiu Panait
2025-05-19 15:13 ` [PATCH 3/3] crypto: sun8i-ce - use helpers to get hash block and digest sizes Ovidiu Panait
2025-05-20  8:24 ` [PATCH 1/3] crypto: sun8i-ce - fix nents passed to dma_unmap_sg() Corentin Labbe
2025-06-13  9:33 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox