diff options
author | Sergey Vlasov <vsu@altlinux.ru> | 2006-04-10 01:32:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-04-10 01:32:48 -0400 |
commit | 9469d458b90bfb9117cbb488cfa645d94c3921b1 (patch) | |
tree | 7b409ef16b310336edddcb396d1601896f39d33b | |
parent | 30aaa154fc21ad1ee4400e28009732a04a80862f (diff) |
[NET]: Fix hotplug race during device registration.
From: Thomas de Grenier de Latour <degrenier@easyconnect.fr>
On Sun, 9 Apr 2006 21:56:59 +0400,
Sergey Vlasov <vsu@altlinux.ru> wrote:
> However, show_address() does not output anything unless
> dev->reg_state == NETREG_REGISTERED - and this state is set by
> netdev_run_todo() only after netdev_register_sysfs() returns, so in
> the meantime (while netdev_register_sysfs() is busy adding the
> "statistics" attribute group) some process may see an empty "address"
> attribute.
I've tried the attached patch, suggested by Sergey Vlasov on
hotplug-devel@, and as far as i can test it works just fine.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/dev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index dfb62998866a..2731570eba5b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -3042,11 +3042,11 @@ void netdev_run_todo(void) | |||
3042 | 3042 | ||
3043 | switch(dev->reg_state) { | 3043 | switch(dev->reg_state) { |
3044 | case NETREG_REGISTERING: | 3044 | case NETREG_REGISTERING: |
3045 | dev->reg_state = NETREG_REGISTERED; | ||
3045 | err = netdev_register_sysfs(dev); | 3046 | err = netdev_register_sysfs(dev); |
3046 | if (err) | 3047 | if (err) |
3047 | printk(KERN_ERR "%s: failed sysfs registration (%d)\n", | 3048 | printk(KERN_ERR "%s: failed sysfs registration (%d)\n", |
3048 | dev->name, err); | 3049 | dev->name, err); |
3049 | dev->reg_state = NETREG_REGISTERED; | ||
3050 | break; | 3050 | break; |
3051 | 3051 | ||
3052 | case NETREG_UNREGISTERING: | 3052 | case NETREG_UNREGISTERING: |