提交 52933f05 编写于 作者: K Kulikov Vasiliy 提交者: David S. Miller

ibm_newemac: use free_netdev(netdev) instead of kfree()

Freeing netdev without free_netdev() leads to net, tx leaks.
I might lead to dereferencing freed pointer.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

@@
struct net_device* dev;
@@

-kfree(dev)
+free_netdev(dev)
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 62038e4a
...@@ -2928,7 +2928,7 @@ static int __devinit emac_probe(struct platform_device *ofdev, ...@@ -2928,7 +2928,7 @@ static int __devinit emac_probe(struct platform_device *ofdev,
if (dev->emac_irq != NO_IRQ) if (dev->emac_irq != NO_IRQ)
irq_dispose_mapping(dev->emac_irq); irq_dispose_mapping(dev->emac_irq);
err_free: err_free:
kfree(ndev); free_netdev(ndev);
err_gone: err_gone:
/* if we were on the bootlist, remove us as we won't show up and /* if we were on the bootlist, remove us as we won't show up and
* wake up all waiters to notify them in case they were waiting * wake up all waiters to notify them in case they were waiting
...@@ -2971,7 +2971,7 @@ static int __devexit emac_remove(struct platform_device *ofdev) ...@@ -2971,7 +2971,7 @@ static int __devexit emac_remove(struct platform_device *ofdev)
if (dev->emac_irq != NO_IRQ) if (dev->emac_irq != NO_IRQ)
irq_dispose_mapping(dev->emac_irq); irq_dispose_mapping(dev->emac_irq);
kfree(dev->ndev); free_netdev(dev->ndev);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册