From: Johannes Berg Date: Mon, 28 Aug 2023 11:59:53 +0000 (+0200) Subject: wifi: cfg80211: reg: hold wiphy mutex for wdev iteration X-Git-Tag: v6.7-rc1~160^2~207^2~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0320d68f568126f617a346f601a58254b55e6c31;p=thirdparty%2Fkernel%2Fstable.git 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 Signed-off-by: Johannes Berg --- diff --git a/net/wireless/reg.c b/net/wireless/reg.c index f861d1d82b184..1cdaf273d7759 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;