From: Stephen Hemminger <shemminger@osdl.org>
To: "Alexander E. Patrakov" <patrakov@ums.usu.ru>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>
Subject: Hotplug race on name change
Date: Fri, 21 Apr 2006 10:25:03 -0700 [thread overview]
Message-ID: <20060421102503.4e44eb28@localhost.localdomain> (raw)
In-Reply-To: <4445BB0F.6010305@ums.usu.ru>
This:
> Without that patch, there is a race when registering network interfaces
> and renaming it with udev rules, because initially the "address" in
> sysfs doesn't contain useful data. See
> http://marc.theaimsgroup.com/?t=114460338900002&r=1&w=2
>
> Breaking the recommended way of assigning persistent network interface
> names is, IMHO, a bug serious enough to be fixed in -stable.
>
> Signed-off-by: Alexander E. Patrakov <patrakov@ums.usu.ru>
>
> ---
>
> --- linux-2.6.16.5/net/core/dev.c
> +++ linux-2.6.16.5/net/core/dev.c
> @@ -2932,11 +2932,11 @@
>
> switch(dev->reg_state) {
> case NETREG_REGISTERING:
> + dev->reg_state = NETREG_REGISTERED;
> err = netdev_register_sysfs(dev);
> if (err)
> printk(KERN_ERR "%s: failed sysfs registration (%d)\n",
> dev->name, err);
> - dev->reg_state = NETREG_REGISTERED;
> break;
>
> case NETREG_UNREGISTERING:
Introduces new races in netdev_register_sysfs if the name changes, because
netdev_register_sysfs runs without RTNL at this point. So if some application gets
in and changes the device name while netdev_register_sysfs is running, then
the class_dev->class_id would end up not matching the netdevice->name.
Not a big issue since, hotplug doesn't get run until the device is registered.
Ideally, it would be possible to create the groups in the class device before it
was registered. It won't work with existing class device interface.
I am working on a patch to extend class_device to allow the creation of groups
to be atomic (like the attributes are).
next parent reply other threads:[~2006-04-21 17:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060418042300.GA11061@kroah.com>
[not found] ` <20060418042345.GB11061@kroah.com>
[not found] ` <44448DFF.3080108@ums.usu.ru>
[not found] ` <20060418153951.GC30485@kroah.com>
[not found] ` <4445BB0F.6010305@ums.usu.ru>
2006-04-21 17:25 ` Stephen Hemminger [this message]
2006-04-22 0:28 ` Hotplug race on name change Herbert Xu
2006-04-24 22:23 ` [PATCH] netdev: hotplug napi race cleanup Stephen Hemminger
2006-04-25 1:30 ` Andrew Morton
2006-04-26 9:43 ` David S. Miller
2006-05-07 1:09 ` David S. Miller
2006-05-08 16:54 ` Stephen Hemminger
2006-05-08 18:37 ` David S. Miller
2006-05-08 19:02 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060421102503.4e44eb28@localhost.localdomain \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=patrakov@ums.usu.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).