It looks like the call to dev_alloc_name() in init_netdev()
isn't protected by the required locking.
This patch adds rtnl_lock/unlock around the call to dev_alloc_name().
Comments? or please apply.
--
~Randy
description: add required locking to init_netdev()'s call to
dev_alloc_name()
patch_name: netinit_alloc_lock.patch
product_versions: Linux 2.6.0-test7
maintainer: davem@xxxxxxxxxx
author: Randy.Dunlap <rddunlap@xxxxxxxx>
patch_version: 2003-10-15.10:55:51
diffstat:=
drivers/net/net_init.c | 3 +++
1 files changed, 3 insertions(+)
diff -Naurp ./drivers/net/net_init.c~dev_alloc_lock ./drivers/net/net_init.c
--- ./drivers/net/net_init.c~dev_alloc_lock 2003-10-15 10:53:02.000000000
-0700
+++ ./drivers/net/net_init.c 2003-10-15 10:53:34.000000000 -0700
@@ -148,11 +148,14 @@ static struct net_device *init_netdev(st
if (dev->name[0] == '\0' || dev->name[0] == ' ') {
strcpy(dev->name, mask);
+ rtnl_lock();
if (dev_alloc_name(dev, mask)<0) {
+ rtnl_unlock();
if (new_device)
kfree(dev);
return NULL;
}
+ rtnl_unlock();
}
netdev_boot_setup_check(dev);
|