mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
crypto: cavium/cpt - fix DMA cleanup using wrong loop index
[ Upstream commit9dbf173bd3] 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:c694b23329("crypto: cavium - 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
ed374dbc70
commit
8afd1007ef
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user