Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <hareshx.sankar.raj@intel.com>
Co-developed-by: Bolemx Sivanagaleela <bolemx.sivanagaleela@intel.com>
Signed-off-by: Bolemx Sivanagaleela <bolemx.sivanagaleela@intel.com>
Reviewed-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Hareshx Sankar Raj and committed by
Herbert Xu
eb7713f5 e3023094

+2 -3
+2 -3
drivers/crypto/intel/qat/qat_common/qat_asym_algs.c
··· 170 170 } 171 171 172 172 areq->dst_len = req->ctx.dh->p_size; 173 + dma_unmap_single(dev, req->out.dh.r, req->ctx.dh->p_size, 174 + DMA_FROM_DEVICE); 173 175 if (req->dst_align) { 174 176 scatterwalk_map_and_copy(req->dst_align, areq->dst, 0, 175 177 areq->dst_len, 1); 176 178 kfree_sensitive(req->dst_align); 177 179 } 178 - 179 - dma_unmap_single(dev, req->out.dh.r, req->ctx.dh->p_size, 180 - DMA_FROM_DEVICE); 181 180 182 181 dma_unmap_single(dev, req->phy_in, sizeof(struct qat_dh_input_params), 183 182 DMA_TO_DEVICE);