summaryrefslogtreecommitdiff
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2023-08-28 13:59:53 +0200
committerJohannes Berg <johannes.berg@intel.com>2023-09-11 11:27:21 +0200
commit0320d68f568126f617a346f601a58254b55e6c31 (patch)
tree89a6ed514caad64f75c53fcc1dacce8c221f8f4e /net/wireless/reg.c
parent0e8185ce1ddebf9de43b1f0fa92bf6dbba6ffb86 (diff)
downloadlwn-0320d68f568126f617a346f601a58254b55e6c31.tar.gz
lwn-0320d68f568126f617a346f601a58254b55e6c31.zip
wifi: cfg80211: reg: hold wiphy mutex for wdev iteration
Since we will want to remove the wdev lock in the future, lock the wiphy here to iterate and check the flags. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f861d1d82b18..1cdaf273d775 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -3575,14 +3575,17 @@ static bool is_wiphy_all_set_reg_flag(enum ieee80211_regulatory_flags flag)
struct wireless_dev *wdev;
for_each_rdev(rdev) {
+ wiphy_lock(&rdev->wiphy);
list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
wdev_lock(wdev);
if (!(wdev->wiphy->regulatory_flags & flag)) {
wdev_unlock(wdev);
+ wiphy_unlock(&rdev->wiphy);
return false;
}
wdev_unlock(wdev);
}
+ wiphy_unlock(&rdev->wiphy);
}
return true;