wifi: cfg80211: sme: hold wiphy lock for wdev iteration
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:54 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 09:27:21 +0000 (11:27 +0200)
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

index 53ba46f85cebb0f3067e31f06490bc2550acd42c..c271f30b58fa6a6f98511dd7251a246dd0b85b3d 100644 (file)
@@ -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;