UPSTREAM: mac80211_hwsim: fix RCU protected chanctx access

We need to RCU protect the chanctx_conf access, so
do that.

Bug: 254441685
Fixes: 585625c955b1 ("mac80211_hwsim: check TX and STA bandwidth")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220505230421.fb8055c081a2.Ic6da3307c77a909bd61a0ea25dc2a4b08fe1b03f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
(cherry picked from commit a59d55568d02bbbdf9c0cc15be9580180f855b4f)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I23d41f60f49439e8d7f579f6369381de8fa09a64
This commit is contained in:
Johannes Berg
2022-05-05 23:04:21 +02:00
committed by Lee Jones
parent e295ae9c84
commit 4009f67147

View File

@@ -2158,11 +2158,14 @@ mac80211_hwsim_sta_rc_update(struct ieee80211_hw *hw,
if (!data->use_chanctx) {
confbw = data->bw;
} else {
struct ieee80211_chanctx_conf *chanctx_conf =
rcu_dereference(vif->chanctx_conf);
struct ieee80211_chanctx_conf *chanctx_conf;
rcu_read_lock();
chanctx_conf = rcu_dereference(vif->chanctx_conf);
if (!WARN_ON(!chanctx_conf))
confbw = chanctx_conf->def.width;
rcu_read_unlock();
}
WARN(bw > hwsim_get_chanwidth(confbw),