Commit cc901de1 authored by Michal Kazior's avatar Michal Kazior Committed by Johannes Berg

mac80211: fix sdata->radar_required locking

radar_required setting wasn't protected by
local->mtx in some places. This should prevent
from scanning/radar detection/roc colliding.
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent c46a73f3
...@@ -970,9 +970,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -970,9 +970,9 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
/* TODO: make hostapd tell us what it wants */ /* TODO: make hostapd tell us what it wants */
sdata->smps_mode = IEEE80211_SMPS_OFF; sdata->smps_mode = IEEE80211_SMPS_OFF;
sdata->needed_rx_chains = sdata->local->rx_chains; sdata->needed_rx_chains = sdata->local->rx_chains;
sdata->radar_required = params->radar_required;
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
sdata->radar_required = params->radar_required;
err = ieee80211_vif_use_channel(sdata, &params->chandef, err = ieee80211_vif_use_channel(sdata, &params->chandef,
IEEE80211_CHANCTX_SHARED); IEEE80211_CHANCTX_SHARED);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
...@@ -3002,8 +3002,8 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -3002,8 +3002,8 @@ static void ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int err, changed = 0; int err, changed = 0;
sdata->radar_required = sdata->csa_radar_required;
mutex_lock(&local->mtx); mutex_lock(&local->mtx);
sdata->radar_required = sdata->csa_radar_required;
err = ieee80211_vif_change_channel(sdata, &changed); err = ieee80211_vif_change_channel(sdata, &changed);
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
if (WARN_ON(err < 0)) if (WARN_ON(err < 0))
......
...@@ -196,6 +196,8 @@ static bool ieee80211_is_radar_required(struct ieee80211_local *local) ...@@ -196,6 +196,8 @@ static bool ieee80211_is_radar_required(struct ieee80211_local *local)
{ {
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
lockdep_assert_held(&local->mtx);
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
if (sdata->radar_required) { if (sdata->radar_required) {
......
...@@ -303,6 +303,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -303,6 +303,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
return; return;
} }
sdata->radar_required = radar_required;
mutex_unlock(&local->mtx); mutex_unlock(&local->mtx);
memcpy(ifibss->bssid, bssid, ETH_ALEN); memcpy(ifibss->bssid, bssid, ETH_ALEN);
...@@ -318,7 +319,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -318,7 +319,6 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
rcu_assign_pointer(ifibss->presp, presp); rcu_assign_pointer(ifibss->presp, presp);
mgmt = (void *)presp->head; mgmt = (void *)presp->head;
sdata->radar_required = radar_required;
sdata->vif.bss_conf.enable_beacon = true; sdata->vif.bss_conf.enable_beacon = true;
sdata->vif.bss_conf.beacon_int = beacon_int; sdata->vif.bss_conf.beacon_int = beacon_int;
sdata->vif.bss_conf.basic_rates = basic_rates; sdata->vif.bss_conf.basic_rates = basic_rates;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment