[PATCH v2 5/7] crypto: qce - terminate the DMA channels if descriptor preparation fails
From: ZhaoJinming
Date: Fri Nov 13 2026 - 07:06:49 EST
qce_dma_prep_sgs() submits the source descriptor to the RX channel before
preparing the destination descriptor on the TX channel. If the TX
preparation fails, the RX descriptor stays on the channel's pending queue
and qce_dma_prep_sgs() returns an error.
qce_aead_async_req_handle() then jumps to error_unmap_src, which unmaps
the scatterlists without terminating the channels. A later
qce_dma_issue_pending() from another request will run the stale RX
descriptor against memory that has already been unmapped and possibly
reused.
Jump to error_terminate on this failure as well, so
qce_dma_terminate_all() drops the partially submitted descriptor before
the scatterlists are unmapped. The error_unmap_src label is no longer
needed; error_terminate falls through to the same source unmap.
Fixes: 9363efb4181c ("crypto: qce - Add support for AEAD algorithms")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: ZhaoJinming <zhaojinming@xxxxxxxxxxxxx>
---
drivers/crypto/qce/aead.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/crypto/qce/aead.c b/drivers/crypto/qce/aead.c
index dd369328c8a6..00c5924c057e 100644
--- a/drivers/crypto/qce/aead.c
+++ b/drivers/crypto/qce/aead.c
@@ -470,7 +470,7 @@ qce_aead_async_req_handle(struct crypto_async_request *async_req)
ret = qce_dma_prep_sgs(&qce->dma, rctx->src_sg, src_nents, rctx->dst_sg, dst_nents,
qce_aead_done, async_req);
if (ret)
- goto error_unmap_src;
+ goto error_terminate;
qce_dma_issue_pending(&qce->dma);
@@ -482,7 +482,6 @@ qce_aead_async_req_handle(struct crypto_async_request *async_req)
error_terminate:
qce_dma_terminate_all(&qce->dma);
-error_unmap_src:
if (diff_dst)
dma_unmap_sg(qce->dev, rctx->src_sg, rctx->src_nents, dir_src);
error_unmap_dst:
--
2.50.1