crypto: cavium/cpt - fix DMA cleanup using wrong loop index
Subsystems (2)
PATCH 1/1 crypto: cavium/cpt - fix DMA cleanup using wrong loop index
The sg_cleanup error path used list[i] instead of list[j] when unmapping DMA buffers, leaking successfully mapped entries and repeatedly unmapping the failed one.
--- drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/cavium/cpt/cptvf_reqmanager.c +2 -2
@@ -108,8 +108,8 @@ static int setup_sgio_components(struct cpt_vf *cptvf, struct buf_ptr *list, sg_cleanup:for (j =0 ; j < i; j++) {if (list[j].dma_addr) { -dma_unmap_single (&pdev->dev, list[i].dma_addr, - list[i].size,DMA_BIDIRECTIONAL ); +dma_unmap_single (&pdev->dev, list[j].dma_addr, + list[j].size,DMA_BIDIRECTIONAL ); } list[j].dma_addr =0 ;
---
base-commit: 08484c504b55a98bd100527fbe10a3caf55ff3ff
change-id: 20260602-cptvf-7dd2d133508f
Best regards,
Signature · 1 line
Felix Gu <[email protected]>
Quoted 3 lines
The
sg_cleanuperror path used list[i] instead of list[j] when unmapping DMA buffers, leaking successfully mapped entries and repeatedly unmapping the failed one.
See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.1-rc6#n94
Regards,
Markus
Herbert Xu
maintainerQuoted 9 lines · Felix Gu
The
sg_cleanuperror path used list[i] instead of list[j] when unmapping DMA buffers, leaking successfully mapped entries and repeatedly unmapping the failed one.Fixes c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")Signed-off-by Felix Gu <[email protected]>--- drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt