Skip to content

Commit

Permalink
wifi: cfg80211: hold wiphy lock in cfg80211_any_wiphy_oper_chan()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jmberg-intel committed Sep 11, 2023
1 parent beb2df4 commit fa8809a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions net/wireless/chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit fa8809a

Please sign in to comment.