]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
atm: nicstar: Unmap DMA on send error
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Mon, 16 Nov 2020 16:21:14 +0000 (17:21 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 11:48:09 +0000 (12:48 +0100)
[ Upstream commit 6dceaa9f56e22d0f9b4c4ad2ed9e04e315ce7fe5 ]

The `skb' is mapped for DMA in ns_send() but does not unmap DMA in case
push_scqe() fails to submit the `skb'. The memory of the `skb' is
released so only the DMA mapping is leaking.

Unmap the DMA mapping in case push_scqe() failed.

Fixes: 864a3ff635fa7 ("atm: [nicstar] remove virt_to_bus() and support 64-bit platforms")
Cc: Chas Williams <3chas3@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/atm/nicstar.c

index ddc4ceb85fc560d4c0295f86e44f6a6e7457995b..49da83f87170b8a2fa803b2d436864677d7af894 100644 (file)
@@ -1704,6 +1704,8 @@ static int ns_send(struct atm_vcc *vcc, struct sk_buff *skb)
 
        if (push_scqe(card, vc, scq, &scqe, skb) != 0) {
                atomic_inc(&vcc->stats->tx_err);
+               dma_unmap_single(&card->pcidev->dev, NS_PRV_DMA(skb), skb->len,
+                                DMA_TO_DEVICE);
                dev_kfree_skb_any(skb);
                return -EIO;
        }