aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/cfg.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/cfg.c')
-rw-r--r--net/mac80211/cfg.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index bfe54daab4b1..aab3c2f29de3 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -828,6 +828,7 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
828 if (cfg80211_chandef_identical(&local->monitor_chandef, chandef)) 828 if (cfg80211_chandef_identical(&local->monitor_chandef, chandef))
829 return 0; 829 return 0;
830 830
831 mutex_lock(&local->mtx);
831 mutex_lock(&local->iflist_mtx); 832 mutex_lock(&local->iflist_mtx);
832 if (local->use_chanctx) { 833 if (local->use_chanctx) {
833 sdata = rcu_dereference_protected( 834 sdata = rcu_dereference_protected(
@@ -846,6 +847,7 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
846 if (ret == 0) 847 if (ret == 0)
847 local->monitor_chandef = *chandef; 848 local->monitor_chandef = *chandef;
848 mutex_unlock(&local->iflist_mtx); 849 mutex_unlock(&local->iflist_mtx);
850 mutex_unlock(&local->mtx);
849 851
850 return ret; 852 return ret;
851} 853}
@@ -951,6 +953,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
951 struct cfg80211_ap_settings *params) 953 struct cfg80211_ap_settings *params)
952{ 954{
953 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 955 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
956 struct ieee80211_local *local = sdata->local;
954 struct beacon_data *old; 957 struct beacon_data *old;
955 struct ieee80211_sub_if_data *vlan; 958 struct ieee80211_sub_if_data *vlan;
956 u32 changed = BSS_CHANGED_BEACON_INT | 959 u32 changed = BSS_CHANGED_BEACON_INT |
@@ -969,8 +972,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
969 sdata->needed_rx_chains = sdata->local->rx_chains; 972 sdata->needed_rx_chains = sdata->local->rx_chains;
970 sdata->radar_required = params->radar_required; 973 sdata->radar_required = params->radar_required;
971 974
975 mutex_lock(&local->mtx);
972 err = ieee80211_vif_use_channel(sdata, &params->chandef, 976 err = ieee80211_vif_use_channel(sdata, &params->chandef,
973 IEEE80211_CHANCTX_SHARED); 977 IEEE80211_CHANCTX_SHARED);
978 mutex_unlock(&local->mtx);
974 if (err) 979 if (err)
975 return err; 980 return err;
976 ieee80211_vif_copy_chanctx_to_vlans(sdata, false); 981 ieee80211_vif_copy_chanctx_to_vlans(sdata, false);
@@ -1121,7 +1126,9 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
1121 skb_queue_purge(&sdata->u.ap.ps.bc_buf); 1126 skb_queue_purge(&sdata->u.ap.ps.bc_buf);
1122 1127
1123 ieee80211_vif_copy_chanctx_to_vlans(sdata, true); 1128 ieee80211_vif_copy_chanctx_to_vlans(sdata, true);
1129 mutex_lock(&local->mtx);
1124 ieee80211_vif_release_channel(sdata); 1130 ieee80211_vif_release_channel(sdata);
1131 mutex_unlock(&local->mtx);
1125 1132
1126 return 0; 1133 return 0;
1127} 1134}
@@ -1944,8 +1951,10 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
1944 sdata->smps_mode = IEEE80211_SMPS_OFF; 1951 sdata->smps_mode = IEEE80211_SMPS_OFF;
1945 sdata->needed_rx_chains = sdata->local->rx_chains; 1952 sdata->needed_rx_chains = sdata->local->rx_chains;
1946 1953
1954 mutex_lock(&sdata->local->mtx);
1947 err = ieee80211_vif_use_channel(sdata, &setup->chandef, 1955 err = ieee80211_vif_use_channel(sdata, &setup->chandef,
1948 IEEE80211_CHANCTX_SHARED); 1956 IEEE80211_CHANCTX_SHARED);
1957 mutex_unlock(&sdata->local->mtx);
1949 if (err) 1958 if (err)
1950 return err; 1959 return err;
1951 1960
@@ -1957,7 +1966,9 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
1957 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1966 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1958 1967
1959 ieee80211_stop_mesh(sdata); 1968 ieee80211_stop_mesh(sdata);
1969 mutex_lock(&sdata->local->mtx);
1960 ieee80211_vif_release_channel(sdata); 1970 ieee80211_vif_release_channel(sdata);
1971 mutex_unlock(&sdata->local->mtx);
1961 1972
1962 return 0; 1973 return 0;
1963} 1974}
@@ -2895,8 +2906,11 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
2895 unsigned long timeout; 2906 unsigned long timeout;
2896 int err; 2907 int err;
2897 2908
2898 if (!list_empty(&local->roc_list) || local->scanning) 2909 mutex_lock(&local->mtx);
2899 return -EBUSY; 2910 if (!list_empty(&local->roc_list) || local->scanning) {
2911 err = -EBUSY;
2912 goto out_unlock;
2913 }
2900 2914
2901 /* whatever, but channel contexts should not complain about that one */ 2915 /* whatever, but channel contexts should not complain about that one */
2902 sdata->smps_mode = IEEE80211_SMPS_OFF; 2916 sdata->smps_mode = IEEE80211_SMPS_OFF;
@@ -2906,13 +2920,15 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
2906 err = ieee80211_vif_use_channel(sdata, chandef, 2920 err = ieee80211_vif_use_channel(sdata, chandef,
2907 IEEE80211_CHANCTX_SHARED); 2921 IEEE80211_CHANCTX_SHARED);
2908 if (err) 2922 if (err)
2909 return err; 2923 goto out_unlock;
2910 2924
2911 timeout = msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS); 2925 timeout = msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS);
2912 ieee80211_queue_delayed_work(&sdata->local->hw, 2926 ieee80211_queue_delayed_work(&sdata->local->hw,
2913 &sdata->dfs_cac_timer_work, timeout); 2927 &sdata->dfs_cac_timer_work, timeout);
2914 2928
2915 return 0; 2929 out_unlock:
2930 mutex_unlock(&local->mtx);
2931 return err;
2916} 2932}
2917 2933
2918static struct cfg80211_beacon_data * 2934static struct cfg80211_beacon_data *
@@ -2988,7 +3004,9 @@ void ieee80211_csa_finalize_work(struct work_struct *work)
2988 goto unlock; 3004 goto unlock;
2989 3005
2990 sdata->radar_required = sdata->csa_radar_required; 3006 sdata->radar_required = sdata->csa_radar_required;
3007 mutex_lock(&local->mtx);
2991 err = ieee80211_vif_change_channel(sdata, &changed); 3008 err = ieee80211_vif_change_channel(sdata, &changed);
3009 mutex_unlock(&local->mtx);
2992 if (WARN_ON(err < 0)) 3010 if (WARN_ON(err < 0))
2993 goto unlock; 3011 goto unlock;
2994 3012