lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 27 Feb 2008 17:05:11 +0000
From:	Jeba Anandhan <jeba.anandhan@...oni.com>
To:	Stephen Hemminger <shemminger@...tta.com>
Cc:	netdev@...r.kernel.org, matthew.hattersley@...oni.com
Subject: Re: unregister_netdev() deadlock

On Wed, 2008-02-27 at 08:46 -0800, Stephen Hemminger wrote:
> 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).

*) Is there any chance of deadlock if i try to unregister_netdev() on
the fly using syscall?
*) is dev->refcnt altered by only dev_hold or dev_put?. what are the
general cases where the dev->refcnt is altered?

Thanks
Jeba
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ