netdev
[Top] [All Lists]

Re: Bug#251215: kernel-image-2.6.6-1-k7: pppd locks up, cannot be kille

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: Bug#251215: kernel-image-2.6.6-1-k7: pppd locks up, cannot be killed, during ppp shutdown
From: "David S. Miller" <davem@xxxxxxxxxx>
Date: Sat, 29 May 2004 12:48:33 -0700
Cc: debian.bugs@xxxxxxxxxxxxxxxx, 251215@xxxxxxxxxxxxxxx, shemminger@xxxxxxxx, jgarzik@xxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040529051736.GA11303@xxxxxxxxxxxxxxxxxxx>
References: <E1BTLVa-000Ezb-FC@xxxxxxxxxxxxxxxxxxxxxxxx> <20040528124355.GA2391@xxxxxxxxxxxxxxxxxxx> <40B744DC.9956BF50@xxxxxxxxxxxxxxxx> <20040529051736.GA11303@xxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Sat, 29 May 2004 15:17:36 +1000
Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> wrote:

> 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);

See?

<Prev in Thread] Current Thread [Next in Thread>