[PATCH 1/3] crypto: marvell/cesa - Fix DMA cache leaks on hash setup errors
From: Haoxiang Li
Date: Wed Nov 18 2026 - 02:57:04 EST
The hash DMA initialization error path frees TDMA descriptors and unmaps
the source scatterlist, but leaves the DMA cache allocated.
Use the full DMA cleanup helper on this path. Clear the cache pointer
after freeing it to prevent stale-pointer reuse on subsequent requests.
Fixes: 7850c91b175d ("crypto: marvell/cesa - fix memory leak")
Signed-off-by: Haoxiang Li <haoxiang_li2024@xxxxxxx>
---
drivers/crypto/marvell/cesa/hash.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/marvell/cesa/hash.c b/drivers/crypto/marvell/cesa/hash.c
index 2f203042d9bd..35f5937b2f8b 100644
--- a/drivers/crypto/marvell/cesa/hash.c
+++ b/drivers/crypto/marvell/cesa/hash.c
@@ -65,6 +65,7 @@ mv_cesa_ahash_dma_free_cache(struct mv_cesa_ahash_dma_req *req)
dma_pool_free(cesa_dev->dma->cache_pool, req->cache,
req->cache_dma);
+ req->cache = NULL;
}
static int mv_cesa_ahash_dma_alloc_padding(struct mv_cesa_ahash_dma_req *req,
@@ -747,8 +748,7 @@ static int mv_cesa_ahash_dma_req_init(struct ahash_request *req)
return 0;
err_free_tdma:
- mv_cesa_dma_cleanup(basereq);
- dma_unmap_sg(cesa_dev->dev, req->src, creq->src_nents, DMA_TO_DEVICE);
+ mv_cesa_ahash_dma_cleanup(req);
err:
mv_cesa_ahash_last_cleanup(req);
--
2.25.1