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
| ||
|
Date: Fri, 06 Apr 2012 18:31:14 -0700 From: "[PATCH 1/2]"@fess.ebiederm.org, "net:In"@fess.ebiederm.org, unregister_netdevice_notifier@...s.ebiederm.org, unregister@...s.ebiederm.org, the@...s.ebiederm.org, "netdevices."@fess.ebiederm.org To: David Miller <davem@...emloft.net> Cc: Eric Dumazet <eric.dumazet@...il.com>, Eric Van Hensbergen <ericvh@...il.com>, Dave Jones <davej@...hat.com>, linux-kernel <linux-kernel@...r.kernel.org>, netdev <netdev@...r.kernel.org>, RĂ©mi Denis-Courmont <remi.denis-courmont@...ia.com>, Sasha Levin <levinsasha928@...il.com> Subject: Re: net: kernel BUG() in net/netns/generic.h:45 We already synthesize events in register_netdevice_notifier and synthesizing events in unregister_netdevice_notifier allows to us remove the need for special case cleanup code. This change should be trivially safe as it adds no new cases for existing callers of unregister_netdevice_notifier to handle. Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com> --- net/core/dev.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/net/core/dev.c b/net/core/dev.c index 452db70..77c0a87 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -1410,14 +1410,34 @@ EXPORT_SYMBOL(register_netdevice_notifier); * register_netdevice_notifier(). The notifier is unlinked into the * kernel structures and may then be reused. A negative errno code * is returned on a failure. + * + * After unregistering unregister and down device events are synthesized + * for all devices on the device list to the removed notifier to remove + * the need for special case cleanup code. */ int unregister_netdevice_notifier(struct notifier_block *nb) { + struct net_device *dev; + struct net *net; int err; rtnl_lock(); err = raw_notifier_chain_unregister(&netdev_chain, nb); + if (err) + goto unlock; + + for_each_net(net) { + for_each_netdev(net, dev) { + if (dev->flags & IFF_UP) { + nb->notifier_call(nb, NETDEV_GOING_DOWN, dev); + nb->notifier_call(nb, NETDEV_DOWN, dev); + } + nb->notifier_call(nb, NETDEV_UNREGISTER, dev); + nb->notifier_call(nb, NETDEV_UNREGISTER_BATCH, dev); + } + } +unlock: rtnl_unlock(); return err; } -- 1.7.2.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists