Re: [PATCH] Fix race condition about network device name allocation

2007-06-13 Thread Dan Aloni
On Wed, Jun 13, 2007 at 09:36:31AM -0700, Stephen Hemminger wrote: > On Wed, 13 Jun 2007 12:45:21 +0300 > Dan Aloni <[EMAIL PROTECTED]> wrote: > > > On Mon, May 14, 2007 at 08:58:40AM -0700, Stephen Hemminger wrote: > > > Kenji Kaneshige found this race between device removal and > > > registratio

Re: [PATCH] Fix race condition about network device name allocation

2007-06-13 Thread Jay Vosburgh
The following patch (based on a patch from Stephen Hemminger <[EMAIL PROTECTED]>) removes use after free conditions in the unregister path for the bonding master. Without this patch, an operation of the form "echo -bond0 > /sys/class/net/bonding_masters" would trigger a NULL pointer deref

Re: [PATCH] Fix race condition about network device name allocation

2007-06-13 Thread Stephen Hemminger
Bonding refers to device after unregistering. This has always been a dangerous thing. The following UNTESTED should fix the problem. --- a/drivers/net/bonding/bond_sysfs.c 2007-06-13 15:48:37.0 -0700 +++ b/drivers/net/bonding/bond_sysfs.c 2007-06-13 15:49:17.0 -0700 @@ -164,9 +16

Re: [PATCH] Fix race condition about network device name allocation

2007-06-13 Thread Stephen Hemminger
On Wed, 13 Jun 2007 12:45:21 +0300 Dan Aloni <[EMAIL PROTECTED]> wrote: > On Mon, May 14, 2007 at 08:58:40AM -0700, Stephen Hemminger wrote: > > Kenji Kaneshige found this race between device removal and > > registration. On unregister it is possible for the old device to > > exist, because sysfs

Re: [PATCH] Fix race condition about network device name allocation

2007-06-13 Thread Dan Aloni
On Mon, May 14, 2007 at 08:58:40AM -0700, Stephen Hemminger wrote: > Kenji Kaneshige found this race between device removal and > registration. On unregister it is possible for the old device to > exist, because sysfs file is still open. A new device with 'eth%d' > will select the same name, but

[PATCH] Fix race condition about network device name allocation

2007-05-14 Thread Stephen Hemminger
Kenji Kaneshige found this race between device removal and registration. On unregister it is possible for the old device to exist, because sysfs file is still open. A new device with 'eth%d' will select the same name, but sysfs kobject register will fial. The following changes the shutdown order

Re: [BUG][PATCH] Fix race condition about network device name allocation

2007-05-14 Thread Stephen Hemminger
On Mon, 14 May 2007 10:33:01 +0900 Kenji Kaneshige <[EMAIL PROTECTED]> wrote: > Hi Stephen, > > Thank you for comments. I'll try your patch. > > I have one concern about your patch, though I don't know very much > about netdev codes. > > @@ -3411,6 +3410,9 @@ void unregister_netdevice(struct n

Re: [BUG][PATCH] Fix race condition about network device name allocation

2007-05-14 Thread Kenji Kaneshige
Hi, > How about the following (untested), instead. It hold a removes the sysfs > entries earlier (on unregister_netdevice), but holds a kobject reference. > Then when todo runs the actual last put free happens. I've confirmed the problem is fixed by Stephen's patch on my reproduction environment.

Re: [BUG][PATCH] Fix race condition about network device name allocation

2007-05-13 Thread Kenji Kaneshige
Hi Stephen, Thank you for comments. I'll try your patch. I have one concern about your patch, though I don't know very much about netdev codes. @@ -3411,6 +3410,9 @@ void unregister_netdevice(struct net_dev > /* Notifier chain MUST detach us from master device. */ > BUG_TRAP(!dev->m

Re: [BUG][PATCH] Fix race condition about network device name allocation

2007-05-11 Thread Stephen Hemminger
On Fri, 11 May 2007 14:40:45 +0900 Kenji Kaneshige <[EMAIL PROTECTED]> wrote: > Hi, > > I encountered the following error when I was hot-plugging network card > using pci hotplug driver. > > kobject_add failed for eth8 with -EEXIST, don't try to register things with > the same name in the same

Re: [BUG][PATCH] Fix race condition about network device name allocation

2007-05-11 Thread Stephen Hemminger
On Fri, 11 May 2007 14:40:45 +0900 Kenji Kaneshige <[EMAIL PROTECTED]> wrote: > Hi, > > I encountered the following error when I was hot-plugging network card > using pci hotplug driver. > > kobject_add failed for eth8 with -EEXIST, don't try to register things with > the same name in the same

[BUG][PATCH] Fix race condition about network device name allocation

2007-05-10 Thread Kenji Kaneshige
Hi, I encountered the following error when I was hot-plugging network card using pci hotplug driver. kobject_add failed for eth8 with -EEXIST, don't try to register things with the same name in the same directory. Call Trace: [] show_stack+0x40/0xa0 sp=e0006