Re: Bug#251215: kernel-image-2.6.6-1-k7: pppd locks up, cannot be killed, during ppp shutdown
From: Stephen Hemminger <hidden>
Date: 2004-06-01 16:13:53
From: Stephen Hemminger <hidden>
Date: 2004-06-01 16:13:53
On Sat, 29 May 2004 12:48:33 -0700 "David S. Miller" [off-list ref] wrote:
On Sat, 29 May 2004 15:17:36 +1000 Herbert Xu [off-list ref] wrote:quoted
Why do we need to call free_netdev after unregistering the netdev from the drivers at all? What's wrong with calling it from run_todo itself?Because the driver is the only agent which knows when it is safe to free up the structure. It may still have some attached memory to free, for example, ala: unregister_netdev(dev); kfree(dev->priv); free_netdev(dev); This is common, for example in drivers/net/tg3.c:tg3_remove_one() we have: struct tg3 *tp = netdev_priv(dev); unregister_netdev(dev); iounmap((void *)tp->regs); free_netdev(dev);
Also, for those device that don't want to do anything in between: dev->destructor = free_netdev; Will end up calling free_netdev in the run_todo processing. This can be very handy when unregister needs to happen in some context already called with RTNL.