Commit f37f7103 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by David S. Miller

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: 4d5ae32f ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63cc54a6
...@@ -576,6 +576,8 @@ static int gmac_setup_txqs(struct net_device *netdev) ...@@ -576,6 +576,8 @@ static int gmac_setup_txqs(struct net_device *netdev)
if (port->txq_dma_base & ~DMA_Q_BASE_MASK) { if (port->txq_dma_base & ~DMA_Q_BASE_MASK) {
dev_warn(geth->dev, "TX queue base is not aligned\n"); 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); kfree(skb_tab);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment