wifi: mac80211: hold wiphy_lock around concurrency checks
authorJohannes Berg <johannes.berg@intel.com>
Mon, 28 Aug 2023 11:59:58 +0000 (13:59 +0200)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 11 Sep 2023 09:27:21 +0000 (11:27 +0200)
We want to replace the locking in mac80211 by just the wiphy
mutex, so hold the lock here around concurrency checks for
the future where the chanctx_mtx used inside goes away.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/iface.c

index e09fec1507a6845ac6af1c7c67eb3e0a6749177b..c528a4bb7f4fec79578d5bb77593e6f1d4bb26ac 100644 (file)
@@ -430,12 +430,13 @@ static int ieee80211_open(struct net_device *dev)
        if (!is_valid_ether_addr(dev->dev_addr))
                return -EADDRNOTAVAIL;
 
+       wiphy_lock(sdata->local->hw.wiphy);
        err = ieee80211_check_concurrent_iface(sdata, sdata->vif.type);
        if (err)
-               return err;
+               goto out;
 
-       wiphy_lock(sdata->local->hw.wiphy);
        err = ieee80211_do_open(&sdata->wdev, true);
+out:
        wiphy_unlock(sdata->local->hw.wiphy);
 
        return err;