aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/wireless/chan.c4
-rw-r--r--net/wireless/core.h3
-rw-r--r--net/wireless/util.c11
3 files changed, 12 insertions, 6 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 434c56b92c3c..1cc4b7cc7372 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -103,15 +103,13 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
103} 103}
104 104
105void 105void
106cfg80211_get_chan_state(struct cfg80211_registered_device *rdev, 106cfg80211_get_chan_state(struct wireless_dev *wdev,
107 struct wireless_dev *wdev,
108 struct ieee80211_channel **chan, 107 struct ieee80211_channel **chan,
109 enum cfg80211_chan_mode *chanmode) 108 enum cfg80211_chan_mode *chanmode)
110{ 109{
111 *chan = NULL; 110 *chan = NULL;
112 *chanmode = CHAN_MODE_UNDEFINED; 111 *chanmode = CHAN_MODE_UNDEFINED;
113 112
114 ASSERT_RDEV_LOCK(rdev);
115 ASSERT_WDEV_LOCK(wdev); 113 ASSERT_WDEV_LOCK(wdev);
116 114
117 if (!netif_running(wdev->netdev)) 115 if (!netif_running(wdev->netdev))
diff --git a/net/wireless/core.h b/net/wireless/core.h
index eae5a25a1691..bac97da751df 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -463,8 +463,7 @@ cfg80211_can_use_chan(struct cfg80211_registered_device *rdev,
463} 463}
464 464
465void 465void
466cfg80211_get_chan_state(struct cfg80211_registered_device *rdev, 466cfg80211_get_chan_state(struct wireless_dev *wdev,
467 struct wireless_dev *wdev,
468 struct ieee80211_channel **chan, 467 struct ieee80211_channel **chan,
469 enum cfg80211_chan_mode *chanmode); 468 enum cfg80211_chan_mode *chanmode);
470 469
diff --git a/net/wireless/util.c b/net/wireless/util.c
index f7a0647bde9a..26f8cd30f712 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1059,7 +1059,16 @@ int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
1059 if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype)) 1059 if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype))
1060 continue; 1060 continue;
1061 1061
1062 cfg80211_get_chan_state(rdev, wdev_iter, &ch, &chmode); 1062 /*
1063 * We may be holding the "wdev" mutex, but now need to lock
1064 * wdev_iter. This is OK because once we get here wdev_iter
1065 * is not wdev (tested above), but we need to use the nested
1066 * locking for lockdep.
1067 */
1068 mutex_lock_nested(&wdev_iter->mtx, 1);
1069 __acquire(wdev_iter->mtx);
1070 cfg80211_get_chan_state(wdev_iter, &ch, &chmode);
1071 wdev_unlock(wdev_iter);
1063 1072
1064 switch (chmode) { 1073 switch (chmode) {
1065 case CHAN_MODE_UNDEFINED: 1074 case CHAN_MODE_UNDEFINED: