2011-12-19 17:04:57

by Maxime Bizon

[permalink] [raw]
Subject: Race in ieee80211_register_hw()


Hi all,

I'm using udev/sysfs to detect when a new phy becomes available, and
then immediately open it.

When I insmod the wifi card module driver, it works most of the times,
but sometimes I get this:

ieee80211 phy0: Failed to initialize rate control algorithm


I noticed that ieee80211_register_hw() first registers the PHY, which
makes it available to userspace, then does subsequent config calls on
it. ieee80211_init_rate_ctrl_alg then fails since local->open_count is
not zero.

This is easy to reproduce by adding an msleep() after wiphy_register()

What lock should I use to surround the whole registration process ?

--
Maxime