On Sun, 09 Apr 2006 14:15:32 -0700 (PDT),
"David S. Miller" <[EMAIL PROTECTED]> wrote:

> 
> I wonder if this will cause other problems by invoked scripts
> seeing the state not advanced yet?
> 

I don't know.

An other way would be to allow reading 'address' also when device is 
in NETREG_REGISTERING state.  I think the time when show_address() can
be called with the device in this state is exactly the spotted race
window (beetween creation of the sysfs entry and reg_state being set
to NETREG_REGISTERED). The attached patch does that and worked here. It 
sounds to me less likely to have other side effects, but sure i may be 
wrong.

-- 
TGL.
--- net/core/net-sysfs.c.orig	2006-04-10 01:03:52.000000000 +0200
+++ net/core/net-sysfs.c	2006-04-10 01:19:48.000000000 +0200
@@ -110,7 +110,7 @@
 	ssize_t ret = -EINVAL;
 
 	read_lock(&dev_base_lock);
-	if (dev_isalive(net))
+	if (dev_isalive(net) || (net->reg_state == NETREG_REGISTERING))
 	    ret = format_addr(buf, net->dev_addr, net->addr_len);
 	read_unlock(&dev_base_lock);
 	return ret;

Reply via email to