Thread (1 message) 1 message, 1 author, 2011-05-03

Re: [PATCH] net: fix rtnl even race in register_netdevice()

From: Kalle Valo <hidden>
Date: 2011-05-03 02:38:43
Also in: linux-wireless

David Miller [off-list ref] writes:
From: Kalle Valo <redacted>
Date: Fri, 29 Apr 2011 20:26:34 +0300
quoted
From: Kalle Valo <redacted>

There's a race in register_netdevice so that the rtnl event is sent before
the device is actually ready. This was visible with flimflam, chrome os
connection manager:
[...]
quoted
The fix is to call netdev_register_kobject() after the device is added
to the list.

Signed-off-by: Kalle Valo <redacted>
This is not correct.

If you move the kobject registry around, you have to change the
error handling cleanup to match.

This change will leave the netdevice on all sorts of lists, it will
also leak a reference to the device.

I also think this points a fundamental problem with this change, in
that you can't register the kobject after the device is added to
the various lists in list_netdevice().

Once it's in those lists, any thread of control can find the device
and those threads of control may try to get at the data backed by
the kobject and therefore they really expect it to be there by
then.

What you can do instead is try to delay the NETREG_REGISTERED
setting, and block the problematic notifications by testing
reg_state or similar.
Thanks for the review. I'll investigate more about this and send v2
once I found a better solution.

-- 
Kalle Valo
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help