Skip to contentSkip to conversation

cfg80211: add missing device list locking

PATCH In review Johannes Berg 2 participants 3 messages Aug 9, 2009 – Aug 10, 2009 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 net/wireless/core.c |    2 ++
 1 file changed, 2 insertions(+)
net/wireless/core.c +2 -0
@@ -710,6 +710,7 @@ static int cfg80211_netdev_notifier_call
 	case NETDEV_UP:
 #ifdef CONFIG_WIRELESS_EXT
 		cfg80211_lock_rdev(rdev);
+		mutex_lock(&rdev->devlist_mtx);
 		wdev_lock(wdev);
 		switch (wdev->iftype) {
 		case NL80211_IFTYPE_ADHOC:
@@ -722,6 +723,7 @@ static int cfg80211_netdev_notifier_call
 			break;
 		}
 		wdev_unlock(wdev);
+		mutex_unlock(&rdev->devlist_mtx);
 		cfg80211_unlock_rdev(rdev);
 #endif
 		break;
#1 lore raw
Quoted 6 lines · Johannes Berg

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.

Thanks for fixing this. I wasn't able to reproduce the warning after one suspend/resume cycle, but I'll test this patch a bit more before I send my Tested-by tag.

Signature · 1 line
Kalle Valo
Tested-by on v1 1/1
#2 lore raw
In reply to Johannes Berg
Quoted 6 lines · Johannes Berg

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.

I have been testing with patch for a day now and no warnings anymore.

Signature · 1 line
Kalle Valo