summaryrefslogtreecommitdiffstats
path: root/net/wireless/chan.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2022-06-27 12:49:03 +0200
committerJohannes Berg <johannes.berg@intel.com>2022-07-01 11:42:58 +0200
commit31177127e067eb73d5ca46ce32a410e41333d42f (patch)
tree764c6871b5773f8e8cbe69b7d0ac256abbe0fffb /net/wireless/chan.c
parentwifi: nl80211: acquire wdev mutex earlier in start_ap (diff)
downloadlinux-31177127e067eb73d5ca46ce32a410e41333d42f.tar.xz
linux-31177127e067eb73d5ca46ce32a410e41333d42f.zip
wifi: nl80211: relax wdev mutex check in wdev_chandef()
In many cases we might get here from driver code that's not really set up to care about the locking, and for the non-MLO cases we really don't care so much about it. So relax the checking here for now, perhaps we should even remove it completely since we might not really care if we point to an invalid link's chandef and can require the caller to check the link validity first. Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/chan.c')
-rw-r--r--net/wireless/chan.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index efc2de4bab57..0e5835cd8c61 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -1433,7 +1433,17 @@ EXPORT_SYMBOL(cfg80211_any_usable_channels);
struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
unsigned int link_id)
{
- ASSERT_WDEV_LOCK(wdev);
+ /*
+ * We need to sort out the locking here - in some cases
+ * where we get here we really just don't care (yet)
+ * about the valid links, but in others we do. But we
+ * get here with various driver cases, so we cannot
+ * easily require the wdev mutex.
+ */
+ if (link_id || wdev->valid_links & BIT(0)) {
+ ASSERT_WDEV_LOCK(wdev);
+ WARN_ON(!(wdev->valid_links & BIT(link_id)));
+ }
switch (wdev->iftype) {
case NL80211_IFTYPE_MESH_POINT: