Patchwork [net-next-2.6] net: emphasize rtnl lock required in call_netdevice_notifiers

login
register
mail settings
Submitter Jiri Pirko
Date April 20, 2010, 8:37 a.m.
Message ID <20100420083729.GA2810@psychotron.lab.eng.brq.redhat.com>
Download mbox | patch
Permalink /patch/50519/
State Accepted
Delegated to: David Miller
Headers show

Comments

Jiri Pirko - April 20, 2010, 8:37 a.m.
Since netdev_chain is guarded by rtnl_lock, ASSERT_RTNL should be present here
to make sure that all callers of call_netdevice_notifiers does the locking
properly.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - April 20, 2010, 8:45 a.m.
From: Jiri Pirko <jpirko@redhat.com>
Date: Tue, 20 Apr 2010 10:37:30 +0200

> Since netdev_chain is guarded by rtnl_lock, ASSERT_RTNL should be present here
> to make sure that all callers of call_netdevice_notifiers does the locking
> properly.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

That seems right, applied, thanks Jiri!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 05a2b29..a7f13a5 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1435,6 +1435,7 @@  EXPORT_SYMBOL(unregister_netdevice_notifier);
 
 int call_netdevice_notifiers(unsigned long val, struct net_device *dev)
 {
+	ASSERT_RTNL();
 	return raw_notifier_call_chain(&netdev_chain, val, dev);
 }