wifi: cfg80211: fix double lock bug in reg_wdev_chan_valid()
authorDan Carpenter <dan.carpenter@linaro.org>
Fri, 9 Jun 2023 10:48:44 +0000 (13:48 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 9 Jun 2023 11:28:41 +0000 (13:28 +0200)
The locking was changed recently so now the caller holds the wiphy_lock()
lock.  Taking the lock inside the reg_wdev_chan_valid() function will
lead to a deadlock.

Fixes: f7e60032c661 ("wifi: cfg80211: fix locking in regulatory disconnect")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/40c4114a-6cb4-4abf-b013-300b598aba65@moroto.mountain
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/reg.c

index 949e1fb3bec6782367fa30b4fe3c0d0ed2abab7d..26f11e4746c05238bf83972e8475557aec284c11 100644 (file)
@@ -2404,11 +2404,8 @@ static bool reg_wdev_chan_valid(struct wiphy *wiphy, struct wireless_dev *wdev)
                case NL80211_IFTYPE_P2P_GO:
                case NL80211_IFTYPE_ADHOC:
                case NL80211_IFTYPE_MESH_POINT:
-                       wiphy_lock(wiphy);
                        ret = cfg80211_reg_can_beacon_relax(wiphy, &chandef,
                                                            iftype);
-                       wiphy_unlock(wiphy);
-
                        if (!ret)
                                return ret;
                        break;