Skip to content

Commit fa8809a

Browse files
committed
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>
1 parent beb2df4 commit fa8809a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

net/wireless/chan.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,13 +824,17 @@ bool cfg80211_any_wiphy_oper_chan(struct wiphy *wiphy,
824824
return false;
825825

826826
for_each_rdev(rdev) {
827+
bool found;
828+
827829
if (!reg_dfs_domain_same(wiphy, &rdev->wiphy))
828830
continue;
829831

830-
if (cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan))
831-
return true;
832+
wiphy_lock(&rdev->wiphy);
833+
found = cfg80211_is_wiphy_oper_chan(&rdev->wiphy, chan) ||
834+
cfg80211_offchan_chain_is_active(rdev, chan);
835+
wiphy_unlock(&rdev->wiphy);
832836

833-
if (cfg80211_offchan_chain_is_active(rdev, chan))
837+
if (found)
834838
return true;
835839
}
836840

0 commit comments

Comments
 (0)