From: Johannes Berg Date: Wed, 6 Jul 2022 08:09:57 +0000 (+0200) Subject: wifi: mac80211: tighten locking check X-Git-Tag: v6.6.17~6916^2~64^2~105 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=939c4c7e823b161701637720016999ef1f4ae4db;p=platform%2Fkernel%2Flinux-rpi.git 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 --- diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 92fe405..5ab2107 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); }