Linux Tegra architecture development
 help / color / mirror / Atom feed
* [PATCH v2] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init()
@ 2026-12-01 13:09 Thomas Fourier
  0 siblings, 0 replies; only message in thread
From: Thomas Fourier @ 2026-12-01 13:09 UTC (permalink / raw)
  Cc: Thomas Fourier, Akhil R, Herbert Xu, David S. Miller,
	Thierry Reding, Jonathan Hunter, open list:CRYPTO API,
	open list:TEGRA ARCHITECTURE SUPPORT

tegra_sha_do_init() allocates residue.buf with rctx->blk_size bytes, but
when allocating intr_res fails it frees the buffer with
rctx->residue.size, which has just been set to 0. This could leave the
buffer DMA-mapped.

Free the residue buffer with rctx->blk_size.

Signed-off-by: Thomas Fourier <fourier.thomas@gmail.com>
Fixes: ff4b7df0b511 ("crypto: tegra - Fix HASH intermediate result handling")
---
v1->v2:
  - Remove changes to eastwood driver that was erroneously included

 drivers/crypto/tegra/tegra-se-hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/tegra/tegra-se-hash.c b/drivers/crypto/tegra/tegra-se-hash.c
index 23d549801612..8a76df20eb95 100644
--- a/drivers/crypto/tegra/tegra-se-hash.c
+++ b/drivers/crypto/tegra/tegra-se-hash.c
@@ -387,7 +387,7 @@ static int tegra_sha_do_init(struct ahash_request *req)
 	return 0;
 
 intr_res_fail:
-	dma_free_coherent(se->dev, rctx->residue.size, rctx->residue.buf,
+	dma_free_coherent(se->dev, rctx->blk_size, rctx->residue.buf,
 			  rctx->residue.addr);
 resbuf_fail:
 	dma_free_coherent(se->dev, rctx->digest.size, rctx->digest.buf,
-- 
2.53.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-12-01 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 13:09 [PATCH v2] crypto: tegra - Fix dma_free_coherent() size in tegra_sha_do_init() Thomas Fourier

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