浏览代码

net: Added ASSERT_RTNL() to dev_open() and dev_close().

dev_open() and dev_close() must be called holding the RTNL, since they
call device functions and netdevice notifiers that are promised the RTNL.

Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ben Hutchings 17 年之前
父节点
当前提交
e46b66bc42
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      net/core/dev.c

+ 4 - 0
net/core/dev.c

@@ -994,6 +994,8 @@ int dev_open(struct net_device *dev)
 {
 {
 	int ret = 0;
 	int ret = 0;
 
 
+	ASSERT_RTNL();
+
 	/*
 	/*
 	 *	Is it already up?
 	 *	Is it already up?
 	 */
 	 */
@@ -1060,6 +1062,8 @@ int dev_open(struct net_device *dev)
  */
  */
 int dev_close(struct net_device *dev)
 int dev_close(struct net_device *dev)
 {
 {
+	ASSERT_RTNL();
+
 	might_sleep();
 	might_sleep();
 
 
 	if (!(dev->flags & IFF_UP))
 	if (!(dev->flags & IFF_UP))