Skip to content

Commit

Permalink
net: gemini: Fix memory leak in gmac_setup_txqs
Browse files Browse the repository at this point in the history
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: 4d5ae32 ("net: ethernet: Add a driver for Gemini gigabit ethernet")
Signed-off-by: Navid Emamdoost <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Navidem authored and davem330 committed Dec 17, 2019
1 parent 63cc54a commit f37f710
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/cortina/gemini.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f37f710

Please sign in to comment.