[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080227084624.163c762b@extreme>
Date: Wed, 27 Feb 2008 08:46:24 -0800
From: Stephen Hemminger <shemminger@...tta.com>
To: Jeba Anandhan <jeba.anandhan@...oni.com>
Cc: netdev@...r.kernel.org, matthew.hattersley@...oni.com
Subject: Re: unregister_netdev() deadlock
On Wed, 27 Feb 2008 15:44:54 +0000
Jeba Anandhan <jeba.anandhan@...oni.com> wrote:
> Hi all,
> I have doubts about unregister the netdevice.
>
> Scenario
> I have two netdevice entities. I wish to unregister one entity.
>
> struct net_device *dev1;
> struct net_device *dev2;
>
> dev1->timer = XXX;
> dev2->timer = YYY;
>
> dev1->ioctl() {
>
> ...
> case delete_other:
> unregister_netdev(dev2);
> free_netdev(dev2);
> return 0;
> ...
> }
>
> The dev2->refcnt is not zero in this case. unregister_netdev(dev2) cause
> deadlock. Could you tell me why it happens?.
>
>
> It works smoothly when we call the unregister_netdev(dev2) from
> cleanup_module(). dev2->refcnt is not zero in this case. Still it is
> able to unregister.
>
>
> Thanks
> Jeba
>
You need to properly manage device refcounts (or delete both).
Also since dev1->ioctl is called with RTNL you can't:
use unregister_netdev() recursive locking (use unregister_netdevice)
or call free_netdev because of netdevice could still be in use (use dev->destructor instead).
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists