Skip to contentSkip to conversation

: Fix hotplug race during device registration

PATCH Chris Rankin 3 participants 6 messages Apr 21, 2006

lore
Share & tools
lore
#0 lore raw

With reference to this patch:
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=2731570eba5b35a21c311dd587057c39805082f1;hp=dfb62998866ae2e298139164a85ec0757b7f3fc7;hb=9469d458b90bfb9117cbb488cfa645d94c3921b1;f=net/core/dev.c

Doesn't this patch introduce another bug when registration fails, because reg_state is left as NETREG_REGISTERED?

Cheers,
Chris

Send instant messages to your online friends http://uk.messenger.yahoo.com

#1 lore raw
Quoted 5 lines · Chris Rankin

With reference to this patch:
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=2731570eba5b35a21c311dd587057c39805082f1;hp=dfb62998866ae2e298139164a85ec0757b7f3fc7;hb=9469d458b90bfb9117cbb488cfa645d94c3921b1;f=net/core/dev.c

Doesn't this patch introduce another bug when registration fails, because reg_state is left as NETREG_REGISTERED?

This could be fixed up by saving the old value and restoring it in the "if (err)" statement, but I guess this has to be fixed in the mainline before allowing the modified "if (err)" into -stable.

Signature · 1 line
Alexander E. Patrakov
#2 lore raw
Quoted 3 lines · --- "Alexander E. Patrakov

This could be fixed up by saving the old value and restoring it in the "if (err)" statement, but I guess this has to be fixed in the mainline before allowing the modified "if (err)" into -stable.

I'm not going to claim to know how this state machine works, but would restoring the state to the original value prompt the kernel to try and reregister the device in an endless loop? I was wondering if maybe it should be set to some "Failed" state instead.

Cheers,
Chris

___________________________________________________________
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

#3 lore raw
In reply to Chris Rankin
Quoted 5 lines · Chris Rankin

With reference to this patch:
http://kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blobdiff;h=2731570eba5b35a21c311dd587057c39805082f1;hp=dfb62998866ae2e298139164a85ec0757b7f3fc7;hb=9469d458b90bfb9117cbb488cfa645d94c3921b1;f=net/core/dev.c

Doesn't this patch introduce another bug when registration fails, because reg_state is left as NETREG_REGISTERED?

Look at the old code again. This is not a new bug. The old code fails registration, does a printk, and then sets dev->reg_state = NETREG_REGISTERED. So this doesn't revoke my signed-off-by line.

Signature · 1 line
Alexander E. Patrakov
#4 lore raw
Quoted 2 lines · --- "Alexander E. Patrakov

Look at the old code again. This is not a new bug. The old code fails registration, does a printk, and then sets dev->reg_state = NETREG_REGISTERED.

OK, fair enough. But anyway, is it valid to leave reg_state as NETREG_REGISTERED when the registration has failed?

Cheers,
Chris

___________________________________________________________
Yahoo! Photos – NEW, now offering a quality print service from just 7p a photo http://uk.photos.yahoo.com

#5 lore raw
Quoted 6 lines · On Fri, 21 Apr 2006 14:52:19 +0100 (BST) Chris Rankin <[email protected]>…
Quoted 2 lines · --- "Alexander E. Patrakov

Look at the old code again. This is not a new bug. The old code fails registration, does a printk, and then sets dev->reg_state = NETREG_REGISTERED.

OK, fair enough. But anyway, is it valid to leave reg_state as NETREG_REGISTERED when the registration has failed?

Yes. the device is still half alive in that case. It is accessible via normal networking calls, and can be unregistered. It just would not show up properly in sysfs.

Not sure how it would be possible (except maybe out of memory) to construct a case where registration fails. Maybe races with name changes.