aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHareshx Sankar Raj <[email protected]>2023-06-05 22:06:06 +0100
committerHerbert Xu <[email protected]>2023-06-16 20:30:35 +0800
commiteb7713f5ca97697b92f225127440d1525119b8de (patch)
treeeb3d93642668f436c1044b96e75356c307e0b05d
parente3023094dffb41540330fb0c74cd3a019cd525c2 (diff)
crypto: qat - unmap buffer before free for DH
The callback function for DH frees the memory allocated for the destination buffer before unmapping it. This sequence is wrong. Change the cleanup sequence to unmap the buffer before freeing it. Fixes: 029aa4624a7f ("crypto: qat - remove dma_free_coherent() for DH") Signed-off-by: Hareshx Sankar Raj <[email protected]> Co-developed-by: Bolemx Sivanagaleela <[email protected]> Signed-off-by: Bolemx Sivanagaleela <[email protected]> Reviewed-by: Giovanni Cabiddu <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Giovanni Cabiddu <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
-rw-r--r--drivers/crypto/intel/qat/qat_common/qat_asym_algs.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c b/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c
index 935a7e012946..8806242469a0 100644
--- a/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c
+++ b/drivers/crypto/intel/qat/qat_common/qat_asym_algs.c
@@ -170,15 +170,14 @@ static void qat_dh_cb(struct icp_qat_fw_pke_resp *resp)
}
areq->dst_len = req->ctx.dh->p_size;
+ dma_unmap_single(dev, req->out.dh.r, req->ctx.dh->p_size,
+ DMA_FROM_DEVICE);
if (req->dst_align) {
scatterwalk_map_and_copy(req->dst_align, areq->dst, 0,
areq->dst_len, 1);
kfree_sensitive(req->dst_align);
}
- dma_unmap_single(dev, req->out.dh.r, req->ctx.dh->p_size,
- DMA_FROM_DEVICE);
-
dma_unmap_single(dev, req->phy_in, sizeof(struct qat_dh_input_params),
DMA_TO_DEVICE);
dma_unmap_single(dev, req->phy_out,