aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-06-10 10:50:29 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-06-10 13:28:41 -0400
commit2f0accc13520b2644b85f80aedce10d10d88b0ca (patch)
tree7c5ce603af5b3e3e738737f464684ce121cc7fdd /net/wireless
parent4e751843d406a4d0471c207872b9e24957de8357 (diff)
cfg80211: fix rfkill locking problem
rfkill currently requires a global lock within the rfkill_register() function, and holds that lock over calls to the set_block() methods. This means that we cannot hold a lock around rfkill_register() that we also require in set_block(), directly or indirectly. Fix cfg80211 to register rfkill outside the block locked by its global lock. Much of what cfg80211 does in the locked block doesn't need to be locked anyway. Reported-by: Vasanthakumar Thiagarajan <vasanth@atheros.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/core.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 3b74b88e10a3..d5850292b3df 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -395,21 +395,23 @@ int wiphy_register(struct wiphy *wiphy)
395 /* check and set up bitrates */ 395 /* check and set up bitrates */
396 ieee80211_set_bitrate_flags(wiphy); 396 ieee80211_set_bitrate_flags(wiphy);
397 397
398 mutex_lock(&cfg80211_mutex);
399
400 /* set up regulatory info */
401 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
402
403 res = device_add(&drv->wiphy.dev); 398 res = device_add(&drv->wiphy.dev);
404 if (res) 399 if (res)
405 goto out_unlock; 400 return res;
406 401
407 res = rfkill_register(drv->rfkill); 402 res = rfkill_register(drv->rfkill);
408 if (res) 403 if (res)
409 goto out_rm_dev; 404 goto out_rm_dev;
410 405
406 mutex_lock(&cfg80211_mutex);
407
408 /* set up regulatory info */
409 wiphy_update_regulatory(wiphy, NL80211_REGDOM_SET_BY_CORE);
410
411 list_add(&drv->list, &cfg80211_drv_list); 411 list_add(&drv->list, &cfg80211_drv_list);
412 412
413 mutex_unlock(&cfg80211_mutex);
414
413 /* add to debugfs */ 415 /* add to debugfs */
414 drv->wiphy.debugfsdir = 416 drv->wiphy.debugfsdir =
415 debugfs_create_dir(wiphy_name(&drv->wiphy), 417 debugfs_create_dir(wiphy_name(&drv->wiphy),
@@ -430,13 +432,10 @@ int wiphy_register(struct wiphy *wiphy)
430 432
431 cfg80211_debugfs_drv_add(drv); 433 cfg80211_debugfs_drv_add(drv);
432 434
433 res = 0; 435 return 0;
434 goto out_unlock;
435 436
436 out_rm_dev: 437 out_rm_dev:
437 device_del(&drv->wiphy.dev); 438 device_del(&drv->wiphy.dev);
438 out_unlock:
439 mutex_unlock(&cfg80211_mutex);
440 return res; 439 return res;
441} 440}
442EXPORT_SYMBOL(wiphy_register); 441EXPORT_SYMBOL(wiphy_register);