Browse Source

cfg80211: add missing device list locking

When calling into the wext code from the NETDEV_UP
notifier, we need to hold the devlist_mtx mutex as
the wext code ends up calling into channel checks.

Reported-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Tested-by: Kalle Valo <kalle.valo@iki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Johannes Berg 16 years ago
parent
commit
aee83eaff8
1 changed files with 2 additions and 0 deletions
  1. 2 0
      net/wireless/core.c

+ 2 - 0
net/wireless/core.c

@@ -710,6 +710,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
 	case NETDEV_UP:
 	case NETDEV_UP:
 #ifdef CONFIG_WIRELESS_EXT
 #ifdef CONFIG_WIRELESS_EXT
 		cfg80211_lock_rdev(rdev);
 		cfg80211_lock_rdev(rdev);
+		mutex_lock(&rdev->devlist_mtx);
 		wdev_lock(wdev);
 		wdev_lock(wdev);
 		switch (wdev->iftype) {
 		switch (wdev->iftype) {
 		case NL80211_IFTYPE_ADHOC:
 		case NL80211_IFTYPE_ADHOC:
@@ -722,6 +723,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb,
 			break;
 			break;
 		}
 		}
 		wdev_unlock(wdev);
 		wdev_unlock(wdev);
+		mutex_unlock(&rdev->devlist_mtx);
 		cfg80211_unlock_rdev(rdev);
 		cfg80211_unlock_rdev(rdev);
 #endif
 #endif
 		break;
 		break;