aboutsummaryrefslogtreecommitdiff
path: root/net/mac80211/chan.c
diff options
context:
space:
mode:
authorGravatar Johannes Berg <johannes.berg@intel.com> 2022-07-06 10:09:57 +0200
committerGravatar Johannes Berg <johannes.berg@intel.com> 2022-07-15 11:43:19 +0200
commit939c4c7e823b161701637720016999ef1f4ae4db (patch)
tree2a93cbb06cddba8db5b63a97088eb1410cd7b27c /net/mac80211/chan.c
parentwifi: cfg80211: clean up links appropriately (diff)
downloadlinux-939c4c7e823b161701637720016999ef1f4ae4db.tar.gz
linux-939c4c7e823b161701637720016999ef1f4ae4db.tar.bz2
linux-939c4c7e823b161701637720016999ef1f4ae4db.zip
wifi: mac80211: tighten locking check
When we remove a link that doesn't have a channel context, we don't really need the local->mtx locking. Tighten the check here. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/chan.c')
-rw-r--r--net/mac80211/chan.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index 92fe40539091..5ab210706123 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -1991,10 +1991,11 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link)
WARN_ON(sdata->dev && netif_carrier_ok(sdata->dev));
- lockdep_assert_held(&sdata->local->mtx);
-
mutex_lock(&sdata->local->chanctx_mtx);
- __ieee80211_link_release_channel(link);
+ if (rcu_access_pointer(link->conf->chanctx_conf)) {
+ lockdep_assert_held(&sdata->local->mtx);
+ __ieee80211_link_release_channel(link);
+ }
mutex_unlock(&sdata->local->chanctx_mtx);
}