* [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index
@ 2026-06-02 14:55 Felix Gu
2026-06-02 19:30 ` Markus Elfring
2026-06-11 8:54 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Felix Gu @ 2026-06-02 14:55 UTC (permalink / raw)
To: George Cherian, Herbert Xu, David S. Miller, David Daney
Cc: George Cherian, linux-crypto, linux-kernel, Felix Gu
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.
Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
index e183b60277ff..de305cbeccbe 100644
--- a/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
+++ b/drivers/crypto/cavium/cpt/cptvf_reqmanager.c
@@ -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,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index
2026-06-02 14:55 [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index Felix Gu
@ 2026-06-02 19:30 ` Markus Elfring
2026-06-11 8:54 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-06-02 19:30 UTC (permalink / raw)
To: Felix Gu, linux-crypto, David Daney, David S. Miller,
George Cherian, Herbert Xu
Cc: LKML, George Cherian
> 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.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index
2026-06-02 14:55 [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index Felix Gu
2026-06-02 19:30 ` Markus Elfring
@ 2026-06-11 8:54 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2026-06-11 8:54 UTC (permalink / raw)
To: Felix Gu
Cc: George Cherian, David S. Miller, David Daney, George Cherian,
linux-crypto, linux-kernel
On Tue, Jun 02, 2026 at 10:55:35PM +0800, Felix Gu wrote:
> 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.
>
> Fixes: c694b233295b ("crypto: cavium - Add the Virtual Function driver for CPT")
> Signed-off-by: Felix Gu <ustc.gu@gmail.com>
> ---
> drivers/crypto/cavium/cpt/cptvf_reqmanager.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-11 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 14:55 [PATCH] crypto: cavium/cpt - fix DMA cleanup using wrong loop index Felix Gu
2026-06-02 19:30 ` Markus Elfring
2026-06-11 8:54 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®