Commit 9bab38e4 authored by Thomas de Grenier de Latour's avatar Thomas de Grenier de Latour Committed by Greg Kroah-Hartman

[PATCH] Fix hotplug race during device registration

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: default avatarAlexander Patrakov <patrakov@ums.usu.ru>
Signed-off-by: default avatarDavid Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5d0b6f2b
...@@ -2932,11 +2932,11 @@ void netdev_run_todo(void) ...@@ -2932,11 +2932,11 @@ void netdev_run_todo(void)
switch(dev->reg_state) { switch(dev->reg_state) {
case NETREG_REGISTERING: case NETREG_REGISTERING:
dev->reg_state = NETREG_REGISTERED;
err = netdev_register_sysfs(dev); err = netdev_register_sysfs(dev);
if (err) if (err)
printk(KERN_ERR "%s: failed sysfs registration (%d)\n", printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
dev->name, err); dev->name, err);
dev->reg_state = NETREG_REGISTERED;
break; break;
case NETREG_UNREGISTERING: case NETREG_UNREGISTERING:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment