diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-08-28 13:59:55 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-09-11 11:27:21 +0200 |
commit | fa8809a519d85f498f43fadaf82e10831f20625a (patch) | |
tree | c7db2ff9aa2490544ab19558ef35da3910fb3cde /net/wireless | |
parent | beb2df475b7cfcc3e107afb4dd2a031bc34fe416 (diff) | |
download | linux-stable-fa8809a519d85f498f43fadaf82e10831f20625a.tar.gz linux-stable-fa8809a519d85f498f43fadaf82e10831f20625a.tar.bz2 linux-stable-fa8809a519d85f498f43fadaf82e10831f20625a.zip |
wifi: cfg80211: hold wiphy lock in cfg80211_any_wiphy_oper_chan()
We have the RTNL here for the iteration, but we need to lock
each wiphy separately as well for using its data. Hold the
wiphy lock for all of the ones in the iteration. Note that
this implies we cannot already hold the wiphy mutex for the
wiphy passed by the argument, but that's true now.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/chan.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 3c691ae904d1..b2469e2c1e70 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -824,13 +824,17 @@ bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy, return false; for_each_rdev(rdev) { + bool found; + if (!reg_dfs_domain_same(wiphy, &rdev->wiphy)) continue; - if (cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan)) - return true; + wiphy_lock(&rdev->wiphy); + found = cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan) || + cfg80211_offchan_chain_is_active(rdev, chan); + wiphy_unlock(&rdev->wiphy); - if (cfg80211_offchan_chain_is_active(rdev, chan)) + if (found) return true; } |