Message ID | iwlwifi.20211129152938.faf291271590.I40ad9372a47cbad53b4aae7b5a6ccc0dc3fddf8b@changeid (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Johannes Berg |
Headers | show |
Series | cfg80211/mac80211 patches from our internal tree 2021-11-29 | expand |
Luca Coelho <luca@coelho.fi> writes: > From: Ilan Peer <ilan.peer@intel.com> > > 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: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") > Signed-off-by: Ilan Peer <ilan.peer@intel.com> > Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") Duplicate Fixes tags.
On Wed, 2021-12-01 at 15:47 +0200, Kalle Valo wrote: > Luca Coelho <luca@coelho.fi> writes: > > > From: Ilan Peer <ilan.peer@intel.com> > > > > 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: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") > > Signed-off-by: Ilan Peer <ilan.peer@intel.com> > > Fixes: a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") > > Duplicate Fixes tags. Thanks for noticing! My script adds the tag automatically, but it doesn't check (yet) whether the tag was already there... I'll send v2 without it. -- Cheers, Luca.
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index df87c7f3a049..6f6da1cedd80 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -2338,6 +2338,7 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) struct cfg80211_chan_def chandef = {}; struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); enum nl80211_iftype iftype; + bool ret; wdev_lock(wdev); iftype = wdev->iftype; @@ -2387,7 +2388,11 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev) case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: case NL80211_IFTYPE_ADHOC: - return cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); + wiphy_lock(wiphy); + ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef, iftype); + wiphy_unlock(wiphy); + + return ret; case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_P2P_CLIENT: return cfg80211_chandef_usable(wiphy, &chandef, @@ -2409,7 +2414,6 @@ static void reg_leave_invalid_chans(struct wiphy *wiphy) struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy); ASSERT_RTNL(); - list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) if (!reg_wdev_chan_valid(wiphy, wdev)) cfg80211_leave(rdev, wdev);