Commit 953fc0bd authored by Stephen Hemminger's avatar Stephen Hemminger

[NET]: free_netdev - fix leaky drivers

When doing the audit for this change, it was obvious that several drivers
allocate but never free the net_device.

This fixes these drivers.  This patch is riskier than the earlier
ones, because it isn't just a simple substitution and maybe there
is a reason they never free.
parent de752cfc
...@@ -1534,7 +1534,7 @@ static void __exit mpt_lan_exit(void) ...@@ -1534,7 +1534,7 @@ static void __exit mpt_lan_exit(void)
printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n", printk (KERN_INFO ": %s/%s: Fusion MPT LAN device unregistered\n",
IOC_AND_NETDEV_NAMES_s_s(dev)); IOC_AND_NETDEV_NAMES_s_s(dev));
unregister_netdev(dev); unregister_netdev(dev);
//mpt_landev[i] = (struct net_device *) 0xdeadbeef; /* Debug */ free_netdev(dev);
mpt_landev[i] = NULL; mpt_landev[i] = NULL;
} }
......
...@@ -1596,7 +1596,7 @@ static void __exit lasi_82596_exit(void) ...@@ -1596,7 +1596,7 @@ static void __exit lasi_82596_exit(void)
lp = (struct i596_private *) netdevice->priv; lp = (struct i596_private *) netdevice->priv;
dma_free_noncoherent(lp->dev, sizeof(struct i596_private), dma_free_noncoherent(lp->dev, sizeof(struct i596_private),
(void *)netdevice->mem_start, lp->dma_addr); (void *)netdevice->mem_start, lp->dma_addr);
netdevice->priv = NULL; free_netdev(netdevice);
} }
unregister_parisc_driver(&lan_driver); unregister_parisc_driver(&lan_driver);
......
...@@ -632,6 +632,7 @@ static void sppp_channel_delete(struct channel_data *chan) ...@@ -632,6 +632,7 @@ static void sppp_channel_delete(struct channel_data *chan)
{ {
sppp_detach(chan->pppdev.dev); sppp_detach(chan->pppdev.dev);
unregister_netdev(chan->pppdev.dev); unregister_netdev(chan->pppdev.dev);
free_netdev(chan->ppp.dev);
} }
static int cosa_sppp_open(struct net_device *d) static int cosa_sppp_open(struct net_device *d)
......
...@@ -1635,6 +1635,7 @@ eth_unbind (struct usb_gadget *gadget) ...@@ -1635,6 +1635,7 @@ eth_unbind (struct usb_gadget *gadget)
} }
unregister_netdev (dev->net); unregister_netdev (dev->net);
free_netdev(dev->net);
/* assuming we used keventd, it must quiesce too */ /* assuming we used keventd, it must quiesce too */
flush_scheduled_work (); flush_scheduled_work ();
......
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