]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: marvell/octeontx - fix DMA cleanup using wrong loop index
authorFelix Gu <ustc.gu@gmail.com>
Tue, 2 Jun 2026 14:38:26 +0000 (22:38 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jun 2026 01:56:45 +0000 (09:56 +0800)
The sg_cleanup path used list[i] instead of list[j] when unmapping DMA
buffers, leaking successfully mapped entries and repeatedly unmapping
the failed one.

Fixes: 10b4f09491bf ("crypto: marvell - add the Virtual Function driver for CPT")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/octeontx/otx_cptvf_reqmgr.c

index c80baf1ad90b2f0d3ec4cfd4a7cf3a94b1fe5d5c..89030e2711ce41feea1211ebe45aa5b2e64f5691 100644 (file)
@@ -157,8 +157,8 @@ static inline int setup_sgio_components(struct pci_dev *pdev,
 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;