diff mbox series

[26/40] wifi: cfg80211: sme: hold wiphy lock for wdev iteration

Message ID 20230828135928.1189e740f153.I098fcd58f32968aee65b4876c2cfef7fcedaf160@changeid (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series wifi: cfg80211/mac80211: locking cleanups | expand

Commit Message

Johannes Berg Aug. 28, 2023, 11:59 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Since we will want to remove the wdev lock in the future,
lock the wiphy here to iterate and for checking the status
of the connections.

Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/wireless/sme.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 53ba46f85ceb..c271f30b58fa 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -703,6 +703,7 @@  static bool cfg80211_is_all_idle(void)
 	 * as chan dfs state, etc.
 	 */
 	for_each_rdev(rdev) {
+		wiphy_lock(&rdev->wiphy);
 		list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
 			wdev_lock(wdev);
 			if (wdev->conn || wdev->connected ||
@@ -710,6 +711,7 @@  static bool cfg80211_is_all_idle(void)
 				is_all_idle = false;
 			wdev_unlock(wdev);
 		}
+		wiphy_unlock(&rdev->wiphy);
 	}
 
 	return is_all_idle;