crypto: ixp4xx - dma_unmap the correct address
authorCorentin Labbe <clabbe@baylibre.com>
Wed, 5 May 2021 20:26:08 +0000 (20:26 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 May 2021 11:07:56 +0000 (19:07 +0800)
Testing ixp4xx_crypto with CONFIG_DMA_API_DEBUG lead to the following error:
DMA-API: platform ixp4xx_crypto.0: device driver tries to free DMA memory it has not allocated [device address=0x0000000000000000] [size=24 bytes]

This is due to dma_unmap using the wrong address.

Fixes: 0d44dc59b2b4 ("crypto: ixp4xx - Fix handling of chained sg buffers")
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ixp4xx_crypto.c

index 0616e369522e97b097850b4bf0e989ccfa154d6b..ed3deaa5ed2b835b1a3e04f742777abc6ee2767a 100644 (file)
@@ -330,7 +330,7 @@ static void free_buf_chain(struct device *dev, struct buffer_desc *buf,
 
                buf1 = buf->next;
                phys1 = buf->phys_next;
-               dma_unmap_single(dev, buf->phys_next, buf->buf_len, buf->dir);
+               dma_unmap_single(dev, buf->phys_addr, buf->buf_len, buf->dir);
                dma_pool_free(buffer_pool, buf, phys);
                buf = buf1;
                phys = phys1;