Skip to content

Commit e08ebd6

Browse files
ilanpeer2jmberg-intel
authored andcommitted
cfg80211: Acquire wiphy mutex on regulatory work
The function cfg80211_reg_can_beacon_relax() expects wiphy mutex to be held when it is being called. However, when reg_leave_invalid_chans() is called the mutex is not held. Fix it by acquiring the lock before calling the function. Fixes: a05829a ("cfg80211: avoid holding the RTNL when calling the driver") Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20211202152831.527686cda037.I40ad9372a47cbad53b4aae7b5a6ccc0dc3fddf8b@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 06c41bd commit e08ebd6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/wireless/reg.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2359,6 +2359,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
23592359
struct cfg80211_chan_def chandef = {};
23602360
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
23612361
enum nl80211_iftype iftype;
2362+
bool ret;
23622363

23632364
wdev_lock(wdev);
23642365
iftype = wdev->iftype;
@@ -2408,7 +2409,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
24082409
case NL80211_IFTYPE_AP:
24092410
case NL80211_IFTYPE_P2P_GO:
24102411
case NL80211_IFTYPE_ADHOC:
2411-
return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
2412+
wiphy_lock(wiphy);
2413+
ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype);
2414+
wiphy_unlock(wiphy);
2415+
2416+
return ret;
24122417
case NL80211_IFTYPE_STATION:
24132418
case NL80211_IFTYPE_P2P_CLIENT:
24142419
return cfg80211_chandef_usable(wiphy, &chandef,

0 commit comments

Comments
 (0)