summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNavid Emamdoost <navid.emamdoost@gmail.com>2019-12-15 02:10:44 +0100
committerDavid S. Miller <davem@davemloft.net>2019-12-17 01:26:54 +0100
commitf37f710353677639bc5d37ee785335994adf2529 (patch)
tree298b95edf7f3ca9b59050c14e410b7821193770e /drivers
parentnet: dsa: b53: Fix egress flooding settings (diff)
downloadlinux-f37f710353677639bc5d37ee785335994adf2529.tar.xz
linux-f37f710353677639bc5d37ee785335994adf2529.zip
net: gemini: Fix memory leak in gmac_setup_txqs
In the implementation of gmac_setup_txqs() the allocated desc_ring is leaked if TX queue base is not aligned. Release it via dma_free_coherent. Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/cortina/gemini.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c
index a8f4c69252ff..2814b96751b4 100644
--- a/drivers/net/ethernet/cortina/gemini.c
+++ b/drivers/net/ethernet/cortina/gemini.c
@@ -576,6 +576,8 @@ static int gmac_setup_txqs(struct net_device *netdev)
if (port->txq_dma_base & ~DMA_Q_BASE_MASK) {
dev_warn(geth->dev, "TX queue base is not aligned\n");
+ dma_free_coherent(geth->dev, len * sizeof(*desc_ring),
+ desc_ring, port->txq_dma_base);
kfree(skb_tab);
return -ENOMEM;
}