Commit 0cd8080e authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: remove local->mtx

We now hold the wiphy mutex everywhere that we use or
needed the local->mtx, so we don't need this mutex any
more. Remove it.

Most of this change was done automatically with spatch.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 463559b7
...@@ -887,6 +887,8 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy, ...@@ -887,6 +887,8 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
int ret = 0; int ret = 0;
lockdep_assert_wiphy(local->hw.wiphy);
if (cfg80211_chandef_identical(&local->monitor_chandef, chandef)) if (cfg80211_chandef_identical(&local->monitor_chandef, chandef))
return 0; return 0;
...@@ -895,21 +897,17 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy, ...@@ -895,21 +897,17 @@ static int ieee80211_set_monitor_channel(struct wiphy *wiphy,
local->monitor_sdata); local->monitor_sdata);
if (sdata) { if (sdata) {
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
ret = ieee80211_link_use_channel(&sdata->deflink, ret = ieee80211_link_use_channel(&sdata->deflink,
chandef, chandef,
IEEE80211_CHANCTX_EXCLUSIVE); IEEE80211_CHANCTX_EXCLUSIVE);
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
} else { } else {
mutex_lock(&local->mtx);
if (local->open_count == local->monitors) { if (local->open_count == local->monitors) {
local->_oper_chandef = *chandef; local->_oper_chandef = *chandef;
ieee80211_hw_config(local, 0); ieee80211_hw_config(local, 0);
} }
mutex_unlock(&local->mtx);
} }
if (ret == 0) if (ret == 0)
...@@ -1252,6 +1250,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1252,6 +1250,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_link_data *link; struct ieee80211_link_data *link;
struct ieee80211_bss_conf *link_conf; struct ieee80211_bss_conf *link_conf;
lockdep_assert_wiphy(local->hw.wiphy);
link = sdata_dereference(sdata->link[link_id], sdata); link = sdata_dereference(sdata->link[link_id], sdata);
if (!link) if (!link)
return -ENOLINK; return -ENOLINK;
...@@ -1361,12 +1361,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1361,12 +1361,10 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
return err; return err;
} }
mutex_lock(&local->mtx);
err = ieee80211_link_use_channel(link, &params->chandef, err = ieee80211_link_use_channel(link, &params->chandef,
IEEE80211_CHANCTX_SHARED); IEEE80211_CHANCTX_SHARED);
if (!err) if (!err)
ieee80211_link_copy_chanctx_to_vlans(link, false); ieee80211_link_copy_chanctx_to_vlans(link, false);
mutex_unlock(&local->mtx);
if (err) { if (err) {
link_conf->beacon_int = prev_beacon_int; link_conf->beacon_int = prev_beacon_int;
return err; return err;
...@@ -1477,9 +1475,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1477,9 +1475,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
return 0; return 0;
error: error:
mutex_lock(&local->mtx);
ieee80211_link_release_channel(link); ieee80211_link_release_channel(link);
mutex_unlock(&local->mtx);
return err; return err;
} }
...@@ -1554,6 +1550,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1554,6 +1550,7 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_bss_conf *link_conf = link->conf; struct ieee80211_bss_conf *link_conf = link->conf;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
old_beacon = sdata_dereference(link->u.ap.beacon, sdata); old_beacon = sdata_dereference(link->u.ap.beacon, sdata);
if (!old_beacon) if (!old_beacon)
...@@ -1567,7 +1564,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1567,7 +1564,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
sdata); sdata);
/* abort any running channel switch or color change */ /* abort any running channel switch or color change */
mutex_lock(&local->mtx);
link_conf->csa_active = false; link_conf->csa_active = false;
link_conf->color_change_active = false; link_conf->color_change_active = false;
if (link->csa_block_tx) { if (link->csa_block_tx) {
...@@ -1576,8 +1572,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1576,8 +1572,6 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
link->csa_block_tx = false; link->csa_block_tx = false;
} }
mutex_unlock(&local->mtx);
ieee80211_free_next_beacon(link); ieee80211_free_next_beacon(link);
/* turn off carrier for this interface and dependent VLANs */ /* turn off carrier for this interface and dependent VLANs */
...@@ -1632,10 +1626,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, ...@@ -1632,10 +1626,8 @@ static int ieee80211_stop_ap(struct wiphy *wiphy, struct net_device *dev,
local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf); local->total_ps_buffered -= skb_queue_len(&sdata->u.ap.ps.bc_buf);
ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf); ieee80211_purge_tx_queue(&local->hw, &sdata->u.ap.ps.bc_buf);
mutex_lock(&local->mtx);
ieee80211_link_copy_chanctx_to_vlans(link, true); ieee80211_link_copy_chanctx_to_vlans(link, true);
ieee80211_link_release_channel(link); ieee80211_link_release_channel(link);
mutex_unlock(&local->mtx);
return 0; return 0;
} }
...@@ -2601,6 +2593,8 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, ...@@ -2601,6 +2593,8 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
int err; int err;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config)); memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config));
err = copy_mesh_setup(ifmsh, setup); err = copy_mesh_setup(ifmsh, setup);
if (err) if (err)
...@@ -2612,10 +2606,8 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, ...@@ -2612,10 +2606,8 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
sdata->deflink.needed_rx_chains = sdata->local->rx_chains; sdata->deflink.needed_rx_chains = sdata->local->rx_chains;
mutex_lock(&sdata->local->mtx);
err = ieee80211_link_use_channel(&sdata->deflink, &setup->chandef, err = ieee80211_link_use_channel(&sdata->deflink, &setup->chandef,
IEEE80211_CHANCTX_SHARED); IEEE80211_CHANCTX_SHARED);
mutex_unlock(&sdata->local->mtx);
if (err) if (err)
return err; return err;
...@@ -2626,11 +2618,11 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) ...@@ -2626,11 +2618,11 @@ static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
lockdep_assert_wiphy(sdata->local->hw.wiphy);
ieee80211_stop_mesh(sdata); ieee80211_stop_mesh(sdata);
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
kfree(sdata->u.mesh.ie); kfree(sdata->u.mesh.ie);
mutex_unlock(&sdata->local->mtx);
return 0; return 0;
} }
...@@ -3376,7 +3368,8 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, ...@@ -3376,7 +3368,8 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int err; int err;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!list_empty(&local->roc_list) || local->scanning) { if (!list_empty(&local->roc_list) || local->scanning) {
err = -EBUSY; err = -EBUSY;
goto out_unlock; goto out_unlock;
...@@ -3395,7 +3388,6 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy, ...@@ -3395,7 +3388,6 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,
msecs_to_jiffies(cac_time_ms)); msecs_to_jiffies(cac_time_ms));
out_unlock: out_unlock:
mutex_unlock(&local->mtx);
return err; return err;
} }
...@@ -3405,7 +3397,8 @@ static void ieee80211_end_cac(struct wiphy *wiphy, ...@@ -3405,7 +3397,8 @@ static void ieee80211_end_cac(struct wiphy *wiphy,
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(sdata, &local->interfaces, list) { list_for_each_entry(sdata, &local->interfaces, list) {
/* it might be waiting for the local->mtx, but then /* it might be waiting for the local->mtx, but then
* by the time it gets it, sdata->wdev.cac_started * by the time it gets it, sdata->wdev.cac_started
...@@ -3419,7 +3412,6 @@ static void ieee80211_end_cac(struct wiphy *wiphy, ...@@ -3419,7 +3412,6 @@ static void ieee80211_end_cac(struct wiphy *wiphy,
sdata->wdev.cac_started = false; sdata->wdev.cac_started = false;
} }
} }
mutex_unlock(&local->mtx);
} }
static struct cfg80211_beacon_data * static struct cfg80211_beacon_data *
...@@ -3618,7 +3610,6 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -3618,7 +3610,6 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
int err; int err;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
/* /*
...@@ -3691,7 +3682,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -3691,7 +3682,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
/* AP might have been stopped while waiting for the lock. */ /* AP might have been stopped while waiting for the lock. */
...@@ -3704,7 +3694,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -3704,7 +3694,6 @@ void ieee80211_csa_finalize_work(struct wiphy *wiphy, struct wiphy_work *work)
ieee80211_csa_finalize(sdata); ieee80211_csa_finalize(sdata);
unlock: unlock:
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -3862,7 +3851,6 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3862,7 +3851,6 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
int err; int err;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
if (!list_empty(&local->roc_list) || local->scanning) if (!list_empty(&local->roc_list) || local->scanning)
...@@ -3962,18 +3950,15 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, ...@@ -3962,18 +3950,15 @@ int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int err;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
err = __ieee80211_channel_switch(wiphy, dev, params);
mutex_unlock(&local->mtx);
return err; return __ieee80211_channel_switch(wiphy, dev, params);
} }
u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local) u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local)
{ {
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
local->roc_cookie_counter++; local->roc_cookie_counter++;
...@@ -4102,7 +4087,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, ...@@ -4102,7 +4087,7 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
int ret; int ret;
/* the lock is needed to assign the cookie later */ /* the lock is needed to assign the cookie later */
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get_bss(sdata, peer); sta = sta_info_get_bss(sdata, peer);
...@@ -4173,7 +4158,6 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev, ...@@ -4173,7 +4158,6 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
ret = 0; ret = 0;
unlock: unlock:
rcu_read_unlock(); rcu_read_unlock();
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -4682,7 +4666,7 @@ static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata) ...@@ -4682,7 +4666,7 @@ static int ieee80211_color_change_finalize(struct ieee80211_sub_if_data *sdata)
int err; int err;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
sdata->vif.bss_conf.color_change_active = false; sdata->vif.bss_conf.color_change_active = false;
...@@ -4709,7 +4693,7 @@ void ieee80211_color_change_finalize_work(struct wiphy *wiphy, ...@@ -4709,7 +4693,7 @@ void ieee80211_color_change_finalize_work(struct wiphy *wiphy,
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* AP might have been stopped while waiting for the lock. */ /* AP might have been stopped while waiting for the lock. */
if (!sdata->vif.bss_conf.color_change_active) if (!sdata->vif.bss_conf.color_change_active)
...@@ -4721,7 +4705,6 @@ void ieee80211_color_change_finalize_work(struct wiphy *wiphy, ...@@ -4721,7 +4705,6 @@ void ieee80211_color_change_finalize_work(struct wiphy *wiphy,
ieee80211_color_change_finalize(sdata); ieee80211_color_change_finalize(sdata);
unlock: unlock:
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -4780,12 +4763,11 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, ...@@ -4780,12 +4763,11 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,
int err; int err;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
if (sdata->vif.bss_conf.nontransmitted) if (sdata->vif.bss_conf.nontransmitted)
return -EINVAL; return -EINVAL;
mutex_lock(&local->mtx);
/* don't allow another color change if one is already active or if csa /* don't allow another color change if one is already active or if csa
* is active * is active
*/ */
...@@ -4810,7 +4792,6 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev, ...@@ -4810,7 +4792,6 @@ ieee80211_color_change(struct wiphy *wiphy, struct net_device *dev,
ieee80211_color_change_finalize(sdata); ieee80211_color_change_finalize(sdata);
out: out:
mutex_unlock(&local->mtx);
return err; return err;
} }
...@@ -4832,16 +4813,13 @@ static int ieee80211_add_intf_link(struct wiphy *wiphy, ...@@ -4832,16 +4813,13 @@ static int ieee80211_add_intf_link(struct wiphy *wiphy,
unsigned int link_id) unsigned int link_id)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
int res;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (wdev->use_4addr) if (wdev->use_4addr)
return -EOPNOTSUPP; return -EOPNOTSUPP;
mutex_lock(&sdata->local->mtx); return ieee80211_vif_set_links(sdata, wdev->valid_links, 0);
res = ieee80211_vif_set_links(sdata, wdev->valid_links, 0);
mutex_unlock(&sdata->local->mtx);
return res;
} }
static void ieee80211_del_intf_link(struct wiphy *wiphy, static void ieee80211_del_intf_link(struct wiphy *wiphy,
...@@ -4850,9 +4828,9 @@ static void ieee80211_del_intf_link(struct wiphy *wiphy, ...@@ -4850,9 +4828,9 @@ static void ieee80211_del_intf_link(struct wiphy *wiphy,
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
mutex_lock(&sdata->local->mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
ieee80211_vif_set_links(sdata, wdev->valid_links, 0); ieee80211_vif_set_links(sdata, wdev->valid_links, 0);
mutex_unlock(&sdata->local->mtx);
} }
static int sta_add_link_station(struct ieee80211_local *local, static int sta_add_link_station(struct ieee80211_local *local,
......
...@@ -573,7 +573,7 @@ bool ieee80211_is_radar_required(struct ieee80211_local *local) ...@@ -573,7 +573,7 @@ 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); lockdep_assert_wiphy(local->hw.wiphy);
rcu_read_lock(); rcu_read_lock();
list_for_each_entry_rcu(sdata, &local->interfaces, list) { list_for_each_entry_rcu(sdata, &local->interfaces, list) {
...@@ -604,7 +604,6 @@ ieee80211_chanctx_radar_required(struct ieee80211_local *local, ...@@ -604,7 +604,6 @@ ieee80211_chanctx_radar_required(struct ieee80211_local *local,
bool required = false; bool required = false;
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
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) {
...@@ -666,7 +665,6 @@ static int ieee80211_add_chanctx(struct ieee80211_local *local, ...@@ -666,7 +665,6 @@ static int ieee80211_add_chanctx(struct ieee80211_local *local,
u32 changed; u32 changed;
int err; int err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
if (!local->use_chanctx) if (!local->use_chanctx)
...@@ -699,7 +697,6 @@ ieee80211_new_chanctx(struct ieee80211_local *local, ...@@ -699,7 +697,6 @@ ieee80211_new_chanctx(struct ieee80211_local *local,
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
int err; int err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
ctx = ieee80211_alloc_chanctx(local, chandef, mode); ctx = ieee80211_alloc_chanctx(local, chandef, mode);
...@@ -835,8 +832,6 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, ...@@ -835,8 +832,6 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,
bool radar_enabled; bool radar_enabled;
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
/* for ieee80211_is_radar_required */
lockdep_assert_held(&local->mtx);
radar_enabled = ieee80211_chanctx_radar_required(local, chanctx); radar_enabled = ieee80211_chanctx_radar_required(local, chanctx);
...@@ -1024,7 +1019,7 @@ __ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link, ...@@ -1024,7 +1019,7 @@ __ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link,
if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP)) if (WARN_ON(sdata->vif.type != NL80211_IFTYPE_AP))
return; return;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* Check that conf exists, even when clearing this function /* Check that conf exists, even when clearing this function
* must be called with the AP's channel context still there * must be called with the AP's channel context still there
...@@ -1264,7 +1259,6 @@ ieee80211_link_use_reserved_reassign(struct ieee80211_link_data *link) ...@@ -1264,7 +1259,6 @@ ieee80211_link_use_reserved_reassign(struct ieee80211_link_data *link)
u64 changed = 0; u64 changed = 0;
int err; int err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
new_ctx = link->reserved_chanctx; new_ctx = link->reserved_chanctx;
...@@ -1414,7 +1408,6 @@ static int ieee80211_chsw_switch_hwconf(struct ieee80211_local *local, ...@@ -1414,7 +1408,6 @@ static int ieee80211_chsw_switch_hwconf(struct ieee80211_local *local,
{ {
const struct cfg80211_chan_def *chandef; const struct cfg80211_chan_def *chandef;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
chandef = ieee80211_chanctx_reserved_chandef(local, new_ctx, NULL); chandef = ieee80211_chanctx_reserved_chandef(local, new_ctx, NULL);
...@@ -1436,7 +1429,6 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local, ...@@ -1436,7 +1429,6 @@ static int ieee80211_chsw_switch_vifs(struct ieee80211_local *local,
struct ieee80211_chanctx *ctx, *old_ctx; struct ieee80211_chanctx *ctx, *old_ctx;
int i, err; int i, err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
vif_chsw = kcalloc(n_vifs, sizeof(vif_chsw[0]), GFP_KERNEL); vif_chsw = kcalloc(n_vifs, sizeof(vif_chsw[0]), GFP_KERNEL);
...@@ -1481,7 +1473,6 @@ static int ieee80211_chsw_switch_ctxs(struct ieee80211_local *local) ...@@ -1481,7 +1473,6 @@ static int ieee80211_chsw_switch_ctxs(struct ieee80211_local *local)
struct ieee80211_chanctx *ctx; struct ieee80211_chanctx *ctx;
int err; int err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(ctx, &local->chanctx_list, list) { list_for_each_entry(ctx, &local->chanctx_list, list) {
...@@ -1522,7 +1513,6 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local) ...@@ -1522,7 +1513,6 @@ static int ieee80211_vif_use_reserved_switch(struct ieee80211_local *local)
int err, n_assigned, n_reserved, n_ready; int err, n_assigned, n_reserved, n_ready;
int n_ctx = 0, n_vifs_switch = 0, n_vifs_assign = 0, n_vifs_ctxless = 0; int n_ctx = 0, n_vifs_switch = 0, n_vifs_assign = 0, n_vifs_ctxless = 0;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
/* /*
...@@ -1820,7 +1810,7 @@ int ieee80211_link_use_channel(struct ieee80211_link_data *link, ...@@ -1820,7 +1810,7 @@ int ieee80211_link_use_channel(struct ieee80211_link_data *link,
u8 radar_detect_width = 0; u8 radar_detect_width = 0;
int ret; int ret;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (sdata->vif.active_links && if (sdata->vif.active_links &&
!(sdata->vif.active_links & BIT(link->link_id))) { !(sdata->vif.active_links & BIT(link->link_id))) {
...@@ -1828,8 +1818,6 @@ int ieee80211_link_use_channel(struct ieee80211_link_data *link, ...@@ -1828,8 +1818,6 @@ int ieee80211_link_use_channel(struct ieee80211_link_data *link,
return 0; return 0;
} }
lockdep_assert_wiphy(local->hw.wiphy);
ret = cfg80211_chandef_dfs_required(local->hw.wiphy, ret = cfg80211_chandef_dfs_required(local->hw.wiphy,
chandef, chandef,
sdata->wdev.iftype); sdata->wdev.iftype);
...@@ -1882,7 +1870,6 @@ int ieee80211_link_use_reserved_context(struct ieee80211_link_data *link) ...@@ -1882,7 +1870,6 @@ int ieee80211_link_use_reserved_context(struct ieee80211_link_data *link)
struct ieee80211_chanctx *old_ctx; struct ieee80211_chanctx *old_ctx;
int err; int err;
lockdep_assert_held(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
new_ctx = link->reserved_chanctx; new_ctx = link->reserved_chanctx;
...@@ -2002,10 +1989,8 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link) ...@@ -2002,10 +1989,8 @@ void ieee80211_link_release_channel(struct ieee80211_link_data *link)
lockdep_assert_wiphy(sdata->local->hw.wiphy); lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (rcu_access_pointer(link->conf->chanctx_conf)) { if (rcu_access_pointer(link->conf->chanctx_conf))
lockdep_assert_held(&sdata->local->mtx);
__ieee80211_link_release_channel(link); __ieee80211_link_release_channel(link);
}
} }
void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link) void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link)
......
...@@ -236,6 +236,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -236,6 +236,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
int err; int err;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
/* Reset own TSF to allow time synchronization work. */ /* Reset own TSF to allow time synchronization work. */
drv_reset_tsf(local, sdata); drv_reset_tsf(local, sdata);
...@@ -299,17 +300,14 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -299,17 +300,14 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
radar_required = err; radar_required = err;
mutex_lock(&local->mtx);
if (ieee80211_link_use_channel(&sdata->deflink, &chandef, if (ieee80211_link_use_channel(&sdata->deflink, &chandef,
ifibss->fixed_channel ? ifibss->fixed_channel ?
IEEE80211_CHANCTX_SHARED : IEEE80211_CHANCTX_SHARED :
IEEE80211_CHANCTX_EXCLUSIVE)) { IEEE80211_CHANCTX_EXCLUSIVE)) {
sdata_info(sdata, "Failed to join IBSS, no channel context\n"); sdata_info(sdata, "Failed to join IBSS, no channel context\n");
mutex_unlock(&local->mtx);
return; return;
} }
sdata->deflink.radar_required = radar_required; sdata->deflink.radar_required = radar_required;
mutex_unlock(&local->mtx);
memcpy(ifibss->bssid, bssid, ETH_ALEN); memcpy(ifibss->bssid, bssid, ETH_ALEN);
...@@ -367,9 +365,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -367,9 +365,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
sdata->vif.cfg.ssid_len = 0; sdata->vif.cfg.ssid_len = 0;
RCU_INIT_POINTER(ifibss->presp, NULL); RCU_INIT_POINTER(ifibss->presp, NULL);
kfree_rcu(presp, rcu_head); kfree_rcu(presp, rcu_head);
mutex_lock(&local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&local->mtx);
sdata_info(sdata, "Failed to join IBSS, driver failure: %d\n", sdata_info(sdata, "Failed to join IBSS, driver failure: %d\n",
err); err);
return; return;
...@@ -680,6 +676,8 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -680,6 +676,8 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
struct beacon_data *presp; struct beacon_data *presp;
struct sta_info *sta; struct sta_info *sta;
lockdep_assert_wiphy(local->hw.wiphy);
if (!is_zero_ether_addr(ifibss->bssid)) { if (!is_zero_ether_addr(ifibss->bssid)) {
cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->chandef.chan, cbss = cfg80211_get_bss(local->hw.wiphy, ifibss->chandef.chan,
ifibss->bssid, ifibss->ssid, ifibss->bssid, ifibss->ssid,
...@@ -726,9 +724,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -726,9 +724,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
BSS_CHANGED_IBSS); BSS_CHANGED_IBSS);
drv_leave_ibss(local, sdata); drv_leave_ibss(local, sdata);
mutex_lock(&local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&local->mtx);
} }
static void ieee80211_csa_connection_drop_work(struct wiphy *wiphy, static void ieee80211_csa_connection_drop_work(struct wiphy *wiphy,
......
...@@ -1466,9 +1466,6 @@ struct ieee80211_local { ...@@ -1466,9 +1466,6 @@ struct ieee80211_local {
struct list_head mon_list; /* only that are IFF_UP && !cooked */ struct list_head mon_list; /* only that are IFF_UP && !cooked */
struct mutex iflist_mtx; struct mutex iflist_mtx;
/* mutex for scan and work locking */
struct mutex mtx;
/* Scanning and BSS list */ /* Scanning and BSS list */
unsigned long scanning; unsigned long scanning;
struct cfg80211_ssid scan_ssid; struct cfg80211_ssid scan_ssid;
......
...@@ -110,7 +110,7 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local, ...@@ -110,7 +110,7 @@ static u32 __ieee80211_recalc_idle(struct ieee80211_local *local,
bool working, scanning, active; bool working, scanning, active;
unsigned int led_trig_start = 0, led_trig_stop = 0; unsigned int led_trig_start = 0, led_trig_stop = 0;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
active = force_active || active = force_active ||
!list_empty(&local->chanctx_list) || !list_empty(&local->chanctx_list) ||
...@@ -207,6 +207,8 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata ...@@ -207,6 +207,8 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
struct ieee80211_sub_if_data *scan_sdata; struct ieee80211_sub_if_data *scan_sdata;
int ret = 0; int ret = 0;
lockdep_assert_wiphy(local->hw.wiphy);
/* To be the most flexible here we want to only limit changing the /* To be the most flexible here we want to only limit changing the
* address if the specific interface is doing offchannel work or * address if the specific interface is doing offchannel work or
* scanning. * scanning.
...@@ -214,8 +216,6 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata ...@@ -214,8 +216,6 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
if (netif_carrier_ok(sdata->dev)) if (netif_carrier_ok(sdata->dev))
return -EBUSY; return -EBUSY;
mutex_lock(&local->mtx);
/* First check no ROC work is happening on this iface */ /* First check no ROC work is happening on this iface */
list_for_each_entry(roc, &local->roc_list, list) { list_for_each_entry(roc, &local->roc_list, list) {
if (roc->sdata != sdata) if (roc->sdata != sdata)
...@@ -230,7 +230,7 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata ...@@ -230,7 +230,7 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
/* And if this iface is scanning */ /* And if this iface is scanning */
if (local->scanning) { if (local->scanning) {
scan_sdata = rcu_dereference_protected(local->scan_sdata, scan_sdata = rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (sdata == scan_sdata) if (sdata == scan_sdata)
ret = -EBUSY; ret = -EBUSY;
} }
...@@ -247,7 +247,6 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata ...@@ -247,7 +247,6 @@ static int ieee80211_can_powered_addr_change(struct ieee80211_sub_if_data *sdata
} }
unlock: unlock:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -464,6 +463,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -464,6 +463,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
bool cancel_scan; bool cancel_scan;
struct cfg80211_nan_func *func; struct cfg80211_nan_func *func;
lockdep_assert_wiphy(local->hw.wiphy);
clear_bit(SDATA_STATE_RUNNING, &sdata->state); clear_bit(SDATA_STATE_RUNNING, &sdata->state);
synchronize_rcu(); /* flush _ieee80211_wake_txqs() */ synchronize_rcu(); /* flush _ieee80211_wake_txqs() */
...@@ -534,7 +535,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -534,7 +535,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
"destroying interface with valid links 0x%04x\n", "destroying interface with valid links 0x%04x\n",
sdata->vif.valid_links); sdata->vif.valid_links);
mutex_lock(&local->mtx);
sdata->vif.bss_conf.csa_active = false; sdata->vif.bss_conf.csa_active = false;
if (sdata->vif.type == NL80211_IFTYPE_STATION) if (sdata->vif.type == NL80211_IFTYPE_STATION)
sdata->deflink.u.mgd.csa_waiting_bcn = false; sdata->deflink.u.mgd.csa_waiting_bcn = false;
...@@ -543,7 +543,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -543,7 +543,6 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->deflink.csa_block_tx = false; sdata->deflink.csa_block_tx = false;
} }
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa_finalize_work); wiphy_work_cancel(local->hw.wiphy, &sdata->deflink.csa_finalize_work);
...@@ -555,9 +554,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -555,9 +554,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
if (sdata->wdev.cac_started) { if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef; chandef = sdata->vif.bss_conf.chandef;
WARN_ON(local->suspended); WARN_ON(local->suspended);
mutex_lock(&local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&local->mtx);
cfg80211_cac_event(sdata->dev, &chandef, cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_ABORTED, NL80211_RADAR_CAC_ABORTED,
GFP_KERNEL); GFP_KERNEL);
...@@ -585,9 +582,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -585,9 +582,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
switch (sdata->vif.type) { switch (sdata->vif.type) {
case NL80211_IFTYPE_AP_VLAN: case NL80211_IFTYPE_AP_VLAN:
mutex_lock(&local->mtx);
list_del(&sdata->u.vlan.list); list_del(&sdata->u.vlan.list);
mutex_unlock(&local->mtx);
RCU_INIT_POINTER(sdata->vif.bss_conf.chanctx_conf, NULL); RCU_INIT_POINTER(sdata->vif.bss_conf.chanctx_conf, NULL);
/* see comment in the default case below */ /* see comment in the default case below */
ieee80211_free_keys(sdata, true); ieee80211_free_keys(sdata, true);
...@@ -685,9 +680,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do ...@@ -685,9 +680,7 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
if (local->monitors == 0) if (local->monitors == 0)
ieee80211_del_virtual_monitor(local); ieee80211_del_virtual_monitor(local);
mutex_lock(&local->mtx);
ieee80211_recalc_idle(local); ieee80211_recalc_idle(local);
mutex_unlock(&local->mtx);
if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE)) if (!(sdata->u.mntr.flags & MONITOR_FLAG_ACTIVE))
break; break;
...@@ -1169,10 +1162,8 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local) ...@@ -1169,10 +1162,8 @@ int ieee80211_add_virtual_monitor(struct ieee80211_local *local)
mutex_unlock(&local->iflist_mtx); mutex_unlock(&local->iflist_mtx);
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
ret = ieee80211_link_use_channel(&sdata->deflink, &local->monitor_chandef, ret = ieee80211_link_use_channel(&sdata->deflink, &local->monitor_chandef,
IEEE80211_CHANCTX_EXCLUSIVE); IEEE80211_CHANCTX_EXCLUSIVE);
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
if (ret) { if (ret) {
mutex_lock(&local->iflist_mtx); mutex_lock(&local->iflist_mtx);
...@@ -1217,9 +1208,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local) ...@@ -1217,9 +1208,7 @@ void ieee80211_del_virtual_monitor(struct ieee80211_local *local)
synchronize_net(); synchronize_net();
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
drv_remove_interface(local, sdata); drv_remove_interface(local, sdata);
...@@ -1251,9 +1240,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) ...@@ -1251,9 +1240,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
if (!sdata->bss) if (!sdata->bss)
return -ENOLINK; return -ENOLINK;
mutex_lock(&local->mtx);
list_add(&sdata->u.vlan.list, &sdata->bss->vlans); list_add(&sdata->u.vlan.list, &sdata->bss->vlans);
mutex_unlock(&local->mtx);
master = container_of(sdata->bss, master = container_of(sdata->bss,
struct ieee80211_sub_if_data, u.ap); struct ieee80211_sub_if_data, u.ap);
...@@ -1362,9 +1349,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) ...@@ -1362,9 +1349,7 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
ieee80211_adjust_monitor_flags(sdata, 1); ieee80211_adjust_monitor_flags(sdata, 1);
ieee80211_configure_filter(local); ieee80211_configure_filter(local);
ieee80211_recalc_offload(local); ieee80211_recalc_offload(local);
mutex_lock(&local->mtx);
ieee80211_recalc_idle(local); ieee80211_recalc_idle(local);
mutex_unlock(&local->mtx);
netif_carrier_on(dev); netif_carrier_on(dev);
break; break;
...@@ -1469,11 +1454,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up) ...@@ -1469,11 +1454,8 @@ int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up)
drv_stop(local); drv_stop(local);
err_del_bss: err_del_bss:
sdata->bss = NULL; sdata->bss = NULL;
if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
mutex_lock(&local->mtx);
list_del(&sdata->u.vlan.list); list_del(&sdata->u.vlan.list);
mutex_unlock(&local->mtx);
}
/* might already be clear but that doesn't matter */ /* might already be clear but that doesn't matter */
clear_bit(SDATA_STATE_RUNNING, &sdata->state); clear_bit(SDATA_STATE_RUNNING, &sdata->state);
return res; return res;
......
...@@ -457,7 +457,6 @@ int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links) ...@@ -457,7 +457,6 @@ int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
mutex_lock(&local->mtx);
old_active = sdata->vif.active_links; old_active = sdata->vif.active_links;
if (old_active & active_links) { if (old_active & active_links) {
/* /*
...@@ -473,7 +472,6 @@ int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links) ...@@ -473,7 +472,6 @@ int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links)
/* otherwise switch directly */ /* otherwise switch directly */
ret = _ieee80211_set_active_links(sdata, active_links); ret = _ieee80211_set_active_links(sdata, active_links);
} }
mutex_unlock(&local->mtx);
return ret; return ret;
} }
......
...@@ -804,8 +804,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len, ...@@ -804,8 +804,6 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
__hw_addr_init(&local->mc_list); __hw_addr_init(&local->mc_list);
mutex_init(&local->iflist_mtx); mutex_init(&local->iflist_mtx);
mutex_init(&local->mtx);
spin_lock_init(&local->filter_lock); spin_lock_init(&local->filter_lock);
spin_lock_init(&local->rx_path_lock); spin_lock_init(&local->rx_path_lock);
spin_lock_init(&local->queue_stop_reason_lock); spin_lock_init(&local->queue_stop_reason_lock);
...@@ -1539,7 +1537,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw) ...@@ -1539,7 +1537,6 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
enum nl80211_band band; enum nl80211_band band;
mutex_destroy(&local->iflist_mtx); mutex_destroy(&local->iflist_mtx);
mutex_destroy(&local->mtx);
if (local->wiphy_ciphers_allocated) { if (local->wiphy_ciphers_allocated) {
kfree(local->hw.wiphy->cipher_suites); kfree(local->hw.wiphy->cipher_suites);
......
...@@ -1690,7 +1690,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy, ...@@ -1690,7 +1690,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
return; return;
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
if (!ifmgd->associated) if (!ifmgd->associated)
...@@ -1743,7 +1742,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy, ...@@ -1743,7 +1742,6 @@ static void ieee80211_chswitch_work(struct wiphy *wiphy,
ieee80211_sta_reset_conn_monitor(sdata); ieee80211_sta_reset_conn_monitor(sdata);
out: out:
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
} }
...@@ -1817,8 +1815,6 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link) ...@@ -1817,8 +1815,6 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link)
if (!local->ops->abort_channel_switch) if (!local->ops->abort_channel_switch)
return; return;
mutex_lock(&local->mtx);
ieee80211_link_unreserve_chanctx(link); ieee80211_link_unreserve_chanctx(link);
if (link->csa_block_tx) if (link->csa_block_tx)
...@@ -1828,8 +1824,6 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link) ...@@ -1828,8 +1824,6 @@ ieee80211_sta_abort_chanswitch(struct ieee80211_link_data *link)
link->csa_block_tx = false; link->csa_block_tx = false;
link->conf->csa_active = false; link->conf->csa_active = false;
mutex_unlock(&local->mtx);
drv_abort_channel_switch(sdata); drv_abort_channel_switch(sdata);
} }
...@@ -1875,7 +1869,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1875,7 +1869,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
} }
if (res < 0) if (res < 0)
goto lock_and_drop_connection; goto drop_connection;
if (beacon && link->conf->csa_active && if (beacon && link->conf->csa_active &&
!link->u.mgd.csa_waiting_bcn) { !link->u.mgd.csa_waiting_bcn) {
...@@ -1897,7 +1891,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1897,7 +1891,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
csa_ie.chandef.chan->center_freq, csa_ie.chandef.chan->center_freq,
csa_ie.chandef.width, csa_ie.chandef.center_freq1, csa_ie.chandef.width, csa_ie.chandef.center_freq1,
csa_ie.chandef.center_freq2); csa_ie.chandef.center_freq2);
goto lock_and_drop_connection; goto drop_connection;
} }
if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chandef, if (!cfg80211_chandef_usable(local->hw.wiphy, &csa_ie.chandef,
...@@ -1912,7 +1906,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1912,7 +1906,7 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
csa_ie.chandef.width, csa_ie.chandef.center_freq1, csa_ie.chandef.width, csa_ie.chandef.center_freq1,
csa_ie.chandef.freq1_offset, csa_ie.chandef.freq1_offset,
csa_ie.chandef.center_freq2); csa_ie.chandef.center_freq2);
goto lock_and_drop_connection; goto drop_connection;
} }
if (cfg80211_chandef_identical(&csa_ie.chandef, if (cfg80211_chandef_identical(&csa_ie.chandef,
...@@ -1935,7 +1929,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1935,7 +1929,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
*/ */
ieee80211_teardown_tdls_peers(sdata); ieee80211_teardown_tdls_peers(sdata);
mutex_lock(&local->mtx);
conf = rcu_dereference_protected(link->conf->chanctx_conf, conf = rcu_dereference_protected(link->conf->chanctx_conf,
lockdep_is_held(&local->hw.wiphy->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (!conf) { if (!conf) {
...@@ -1977,7 +1970,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1977,7 +1970,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
if (link->csa_block_tx) if (link->csa_block_tx)
ieee80211_stop_vif_queues(local, sdata, ieee80211_stop_vif_queues(local, sdata,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
mutex_unlock(&local->mtx);
cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef, cfg80211_ch_switch_started_notify(sdata->dev, &csa_ie.chandef,
link->link_id, csa_ie.count, link->link_id, csa_ie.count,
...@@ -1996,8 +1988,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -1996,8 +1988,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
&link->u.mgd.chswitch_work, &link->u.mgd.chswitch_work,
timeout); timeout);
return; return;
lock_and_drop_connection:
mutex_lock(&local->mtx);
drop_connection: drop_connection:
/* /*
* This is just so that the disconnect flow will know that * This is just so that the disconnect flow will know that
...@@ -2011,7 +2001,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link, ...@@ -2011,7 +2001,6 @@ ieee80211_sta_process_chanswitch(struct ieee80211_link_data *link,
wiphy_work_queue(sdata->local->hw.wiphy, wiphy_work_queue(sdata->local->hw.wiphy,
&ifmgd->csa_connection_drop_work); &ifmgd->csa_connection_drop_work);
mutex_unlock(&local->mtx);
} }
static bool static bool
...@@ -2408,14 +2397,14 @@ void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -2408,14 +2397,14 @@ void ieee80211_dfs_cac_timer_work(struct wiphy *wiphy, struct wiphy_work *work)
struct cfg80211_chan_def chandef = link->conf->chandef; struct cfg80211_chan_def chandef = link->conf->chandef;
struct ieee80211_sub_if_data *sdata = link->sdata; struct ieee80211_sub_if_data *sdata = link->sdata;
mutex_lock(&sdata->local->mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (sdata->wdev.cac_started) { if (sdata->wdev.cac_started) {
ieee80211_link_release_channel(link); ieee80211_link_release_channel(link);
cfg80211_cac_event(sdata->dev, &chandef, cfg80211_cac_event(sdata->dev, &chandef,
NL80211_RADAR_CAC_FINISHED, NL80211_RADAR_CAC_FINISHED,
GFP_KERNEL); GFP_KERNEL);
} }
mutex_unlock(&sdata->local->mtx);
} }
static bool static bool
...@@ -2682,7 +2671,7 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local, ...@@ -2682,7 +2671,7 @@ ieee80211_sta_wmm_params(struct ieee80211_local *local,
static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata) static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
{ {
lockdep_assert_held(&sdata->local->mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL; sdata->u.mgd.flags &= ~IEEE80211_STA_CONNECTION_POLL;
ieee80211_run_deferred_scan(sdata->local); ieee80211_run_deferred_scan(sdata->local);
...@@ -2690,9 +2679,9 @@ static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata) ...@@ -2690,9 +2679,9 @@ static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata) static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
{ {
mutex_lock(&sdata->local->mtx); lockdep_assert_wiphy(sdata->local->hw.wiphy);
__ieee80211_stop_poll(sdata); __ieee80211_stop_poll(sdata);
mutex_unlock(&sdata->local->mtx);
} }
static u64 ieee80211_handle_bss_capability(struct ieee80211_link_data *link, static u64 ieee80211_handle_bss_capability(struct ieee80211_link_data *link,
...@@ -2896,6 +2885,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -2896,6 +2885,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
}; };
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(local->hw.wiphy);
if (WARN_ON_ONCE(tx && !frame_buf)) if (WARN_ON_ONCE(tx && !frame_buf))
return; return;
...@@ -3036,7 +3026,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -3036,7 +3026,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
ifmgd->flags = 0; ifmgd->flags = 0;
sdata->deflink.u.mgd.conn_flags = 0; sdata->deflink.u.mgd.conn_flags = 0;
mutex_lock(&local->mtx);
for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) { for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) {
struct ieee80211_link_data *link; struct ieee80211_link_data *link;
...@@ -3055,7 +3044,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata, ...@@ -3055,7 +3044,6 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->deflink.csa_block_tx = false; sdata->deflink.csa_block_tx = false;
} }
mutex_unlock(&local->mtx);
/* existing TX TSPEC sessions no longer exist */ /* existing TX TSPEC sessions no longer exist */
memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec)); memset(ifmgd->tx_tspec, 0, sizeof(ifmgd->tx_tspec));
...@@ -3074,9 +3062,10 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) ...@@ -3074,9 +3062,10 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL)) if (!(ifmgd->flags & IEEE80211_STA_CONNECTION_POLL))
goto out; return;
__ieee80211_stop_poll(sdata); __ieee80211_stop_poll(sdata);
...@@ -3085,7 +3074,7 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) ...@@ -3085,7 +3074,7 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
mutex_unlock(&local->iflist_mtx); mutex_unlock(&local->iflist_mtx);
if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR)) if (ieee80211_hw_check(&sdata->local->hw, CONNECTION_MONITOR))
goto out; return;
/* /*
* We've received a probe response, but are not sure whether * We've received a probe response, but are not sure whether
...@@ -3097,8 +3086,6 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) ...@@ -3097,8 +3086,6 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
mod_timer(&ifmgd->conn_mon_timer, mod_timer(&ifmgd->conn_mon_timer,
round_jiffies_up(jiffies + round_jiffies_up(jiffies +
IEEE80211_CONNECTION_IDLE_TIME)); IEEE80211_CONNECTION_IDLE_TIME));
out:
mutex_unlock(&local->mtx);
} }
static void ieee80211_sta_tx_wmm_ac_notify(struct ieee80211_sub_if_data *sdata, static void ieee80211_sta_tx_wmm_ac_notify(struct ieee80211_sub_if_data *sdata,
...@@ -3230,6 +3217,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, ...@@ -3230,6 +3217,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
bool already = false; bool already = false;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif))) if (WARN_ON_ONCE(ieee80211_vif_is_mld(&sdata->vif)))
return; return;
...@@ -3241,16 +3230,12 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, ...@@ -3241,16 +3230,12 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
if (!ifmgd->associated) if (!ifmgd->associated)
goto out; goto out;
mutex_lock(&sdata->local->mtx);
if (sdata->local->tmp_channel || sdata->local->scanning) { if (sdata->local->tmp_channel || sdata->local->scanning) {
mutex_unlock(&sdata->local->mtx);
goto out; goto out;
} }
if (sdata->local->suspending) { if (sdata->local->suspending) {
/* reschedule after resume */ /* reschedule after resume */
mutex_unlock(&sdata->local->mtx);
ieee80211_reset_ap_probe(sdata); ieee80211_reset_ap_probe(sdata);
goto out; goto out;
} }
...@@ -3279,8 +3264,6 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, ...@@ -3279,8 +3264,6 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata,
ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL;
mutex_unlock(&sdata->local->mtx);
if (already) if (already)
goto out; goto out;
...@@ -3363,6 +3346,8 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -3363,6 +3346,8 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
bool tx; bool tx;
lockdep_assert_wiphy(local->hw.wiphy);
if (!ifmgd->associated) if (!ifmgd->associated)
return; return;
...@@ -3398,7 +3383,6 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -3398,7 +3383,6 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
WLAN_REASON_DEAUTH_LEAVING : WLAN_REASON_DEAUTH_LEAVING :
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
tx, frame_buf); tx, frame_buf);
mutex_lock(&local->mtx);
/* the other links will be destroyed */ /* the other links will be destroyed */
sdata->vif.bss_conf.csa_active = false; sdata->vif.bss_conf.csa_active = false;
sdata->deflink.u.mgd.csa_waiting_bcn = false; sdata->deflink.u.mgd.csa_waiting_bcn = false;
...@@ -3407,7 +3391,6 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -3407,7 +3391,6 @@ static void ___ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)
IEEE80211_QUEUE_STOP_REASON_CSA); IEEE80211_QUEUE_STOP_REASON_CSA);
sdata->deflink.csa_block_tx = false; sdata->deflink.csa_block_tx = false;
} }
mutex_unlock(&local->mtx);
ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx, ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx,
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY,
...@@ -3504,6 +3487,7 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata, ...@@ -3504,6 +3487,7 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data; struct ieee80211_mgd_auth_data *auth_data = sdata->u.mgd.auth_data;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (!assoc) { if (!assoc) {
/* /*
...@@ -3521,10 +3505,8 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata, ...@@ -3521,10 +3505,8 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
BSS_CHANGED_BSSID); BSS_CHANGED_BSSID);
sdata->u.mgd.flags = 0; sdata->u.mgd.flags = 0;
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
ieee80211_vif_set_links(sdata, 0, 0); ieee80211_vif_set_links(sdata, 0, 0);
mutex_unlock(&sdata->local->mtx);
} }
cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss);
...@@ -3545,6 +3527,7 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, ...@@ -3545,6 +3527,7 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data; struct ieee80211_mgd_assoc_data *assoc_data = sdata->u.mgd.assoc_data;
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (status != ASSOC_SUCCESS) { if (status != ASSOC_SUCCESS) {
/* /*
...@@ -3580,10 +3563,8 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, ...@@ -3580,10 +3563,8 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
cfg80211_assoc_failure(sdata->dev, &data); cfg80211_assoc_failure(sdata->dev, &data);
} }
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
ieee80211_vif_set_links(sdata, 0, 0); ieee80211_vif_set_links(sdata, 0, 0);
mutex_unlock(&sdata->local->mtx);
} }
kfree(assoc_data); kfree(assoc_data);
...@@ -4817,6 +4798,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -4817,6 +4798,8 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
u32 i; u32 i;
bool have_80mhz; bool have_80mhz;
lockdep_assert_wiphy(local->hw.wiphy);
rcu_read_lock(); rcu_read_lock();
ies = rcu_dereference(cbss->ies); ies = rcu_dereference(cbss->ies);
...@@ -5018,7 +5001,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -5018,7 +5001,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
/* will change later if needed */ /* will change later if needed */
link->smps_mode = IEEE80211_SMPS_OFF; link->smps_mode = IEEE80211_SMPS_OFF;
mutex_lock(&local->mtx);
/* /*
* If this fails (possibly due to channel context sharing * If this fails (possibly due to channel context sharing
* on incompatible channels, e.g. 80+80 and 160 sharing the * on incompatible channels, e.g. 80+80 and 160 sharing the
...@@ -5039,7 +5021,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -5039,7 +5021,6 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
IEEE80211_CHANCTX_SHARED); IEEE80211_CHANCTX_SHARED);
} }
out: out:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -7083,6 +7064,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -7083,6 +7064,8 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
int err; int err;
bool cont_auth; bool cont_auth;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
/* prepare auth data structure */ /* prepare auth data structure */
switch (req->auth_type) { switch (req->auth_type) {
...@@ -7227,9 +7210,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, ...@@ -7227,9 +7210,7 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
eth_zero_addr(sdata->deflink.u.mgd.bssid); eth_zero_addr(sdata->deflink.u.mgd.bssid);
ieee80211_link_info_change_notify(sdata, &sdata->deflink, ieee80211_link_info_change_notify(sdata, &sdata->deflink,
BSS_CHANGED_BSSID); BSS_CHANGED_BSSID);
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
} }
ifmgd->auth_data = NULL; ifmgd->auth_data = NULL;
kfree(auth_data); kfree(auth_data);
......
...@@ -178,6 +178,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, ...@@ -178,6 +178,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
u64 changed = BSS_CHANGED_OCB | BSS_CHANGED_BSSID; u64 changed = BSS_CHANGED_OCB | BSS_CHANGED_BSSID;
int err; int err;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
if (ifocb->joined == true) if (ifocb->joined == true)
return -EINVAL; return -EINVAL;
...@@ -185,10 +187,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, ...@@ -185,10 +187,8 @@ int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
sdata->deflink.smps_mode = IEEE80211_SMPS_OFF; sdata->deflink.smps_mode = IEEE80211_SMPS_OFF;
sdata->deflink.needed_rx_chains = sdata->local->rx_chains; sdata->deflink.needed_rx_chains = sdata->local->rx_chains;
mutex_lock(&sdata->local->mtx);
err = ieee80211_link_use_channel(&sdata->deflink, &setup->chandef, err = ieee80211_link_use_channel(&sdata->deflink, &setup->chandef,
IEEE80211_CHANCTX_SHARED); IEEE80211_CHANCTX_SHARED);
mutex_unlock(&sdata->local->mtx);
if (err) if (err)
return err; return err;
...@@ -209,6 +209,8 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata) ...@@ -209,6 +209,8 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata)
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
struct sta_info *sta; struct sta_info *sta;
lockdep_assert_wiphy(sdata->local->hw.wiphy);
ifocb->joined = false; ifocb->joined = false;
sta_info_flush(sdata); sta_info_flush(sdata);
...@@ -228,9 +230,7 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata) ...@@ -228,9 +230,7 @@ int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata)
clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state); clear_bit(SDATA_STATE_OFFCHANNEL, &sdata->state);
ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_OCB); ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_OCB);
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
skb_queue_purge(&sdata->skb_queue); skb_queue_purge(&sdata->skb_queue);
......
...@@ -197,7 +197,7 @@ static unsigned long ieee80211_end_finished_rocs(struct ieee80211_local *local, ...@@ -197,7 +197,7 @@ static unsigned long ieee80211_end_finished_rocs(struct ieee80211_local *local,
struct ieee80211_roc_work *roc, *tmp; struct ieee80211_roc_work *roc, *tmp;
long remaining_dur_min = LONG_MAX; long remaining_dur_min = LONG_MAX;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
long remaining; long remaining;
...@@ -264,7 +264,7 @@ static void ieee80211_hw_roc_start(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -264,7 +264,7 @@ static void ieee80211_hw_roc_start(struct wiphy *wiphy, struct wiphy_work *work)
container_of(work, struct ieee80211_local, hw_roc_start); container_of(work, struct ieee80211_local, hw_roc_start);
struct ieee80211_roc_work *roc; struct ieee80211_roc_work *roc;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(roc, &local->roc_list, list) { list_for_each_entry(roc, &local->roc_list, list) {
if (!roc->started) if (!roc->started)
...@@ -273,8 +273,6 @@ static void ieee80211_hw_roc_start(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -273,8 +273,6 @@ static void ieee80211_hw_roc_start(struct wiphy *wiphy, struct wiphy_work *work)
roc->hw_begun = true; roc->hw_begun = true;
ieee80211_handle_roc_started(roc, local->hw_roc_start_time); ieee80211_handle_roc_started(roc, local->hw_roc_start_time);
} }
mutex_unlock(&local->mtx);
} }
void ieee80211_ready_on_channel(struct ieee80211_hw *hw) void ieee80211_ready_on_channel(struct ieee80211_hw *hw)
...@@ -295,7 +293,7 @@ static void _ieee80211_start_next_roc(struct ieee80211_local *local) ...@@ -295,7 +293,7 @@ static void _ieee80211_start_next_roc(struct ieee80211_local *local)
enum ieee80211_roc_type type; enum ieee80211_roc_type type;
u32 min_dur, max_dur; u32 min_dur, max_dur;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (WARN_ON(list_empty(&local->roc_list))) if (WARN_ON(list_empty(&local->roc_list)))
return; return;
...@@ -386,7 +384,7 @@ void ieee80211_start_next_roc(struct ieee80211_local *local) ...@@ -386,7 +384,7 @@ void ieee80211_start_next_roc(struct ieee80211_local *local)
{ {
struct ieee80211_roc_work *roc; struct ieee80211_roc_work *roc;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (list_empty(&local->roc_list)) { if (list_empty(&local->roc_list)) {
ieee80211_run_deferred_scan(local); ieee80211_run_deferred_scan(local);
...@@ -417,7 +415,7 @@ static void __ieee80211_roc_work(struct ieee80211_local *local) ...@@ -417,7 +415,7 @@ static void __ieee80211_roc_work(struct ieee80211_local *local)
struct ieee80211_roc_work *roc; struct ieee80211_roc_work *roc;
bool on_channel; bool on_channel;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (WARN_ON(local->ops->remain_on_channel)) if (WARN_ON(local->ops->remain_on_channel))
return; return;
...@@ -456,9 +454,9 @@ static void ieee80211_roc_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -456,9 +454,9 @@ static void ieee80211_roc_work(struct wiphy *wiphy, struct wiphy_work *work)
struct ieee80211_local *local = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, roc_work.work); container_of(work, struct ieee80211_local, roc_work.work);
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
__ieee80211_roc_work(local); __ieee80211_roc_work(local);
mutex_unlock(&local->mtx);
} }
static void ieee80211_hw_roc_done(struct wiphy *wiphy, struct wiphy_work *work) static void ieee80211_hw_roc_done(struct wiphy *wiphy, struct wiphy_work *work)
...@@ -466,14 +464,12 @@ static void ieee80211_hw_roc_done(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -466,14 +464,12 @@ static void ieee80211_hw_roc_done(struct wiphy *wiphy, struct wiphy_work *work)
struct ieee80211_local *local = struct ieee80211_local *local =
container_of(work, struct ieee80211_local, hw_roc_done); container_of(work, struct ieee80211_local, hw_roc_done);
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
ieee80211_end_finished_rocs(local, jiffies); ieee80211_end_finished_rocs(local, jiffies);
/* if there's another roc, start it now */ /* if there's another roc, start it now */
ieee80211_start_next_roc(local); ieee80211_start_next_roc(local);
mutex_unlock(&local->mtx);
} }
void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw) void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
...@@ -537,7 +533,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local, ...@@ -537,7 +533,7 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
bool queued = false, combine_started = true; bool queued = false, combine_started = true;
int ret; int ret;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (channel->freq_offset) if (channel->freq_offset)
/* this may work, but is untested */ /* this may work, but is untested */
...@@ -675,15 +671,12 @@ int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -675,15 +671,12 @@ int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int ret;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
ret = ieee80211_start_roc_work(local, sdata, chan,
duration, cookie, NULL,
IEEE80211_ROC_TYPE_NORMAL);
mutex_unlock(&local->mtx);
return ret; return ieee80211_start_roc_work(local, sdata, chan,
duration, cookie, NULL,
IEEE80211_ROC_TYPE_NORMAL);
} }
static int ieee80211_cancel_roc(struct ieee80211_local *local, static int ieee80211_cancel_roc(struct ieee80211_local *local,
...@@ -692,12 +685,13 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -692,12 +685,13 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
struct ieee80211_roc_work *roc, *tmp, *found = NULL; struct ieee80211_roc_work *roc, *tmp, *found = NULL;
int ret; int ret;
lockdep_assert_wiphy(local->hw.wiphy);
if (!cookie) if (!cookie)
return -ENOENT; return -ENOENT;
wiphy_work_flush(local->hw.wiphy, &local->hw_roc_start); wiphy_work_flush(local->hw.wiphy, &local->hw_roc_start);
mutex_lock(&local->mtx);
list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
if (!mgmt_tx && roc->cookie != cookie) if (!mgmt_tx && roc->cookie != cookie)
continue; continue;
...@@ -709,7 +703,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -709,7 +703,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
} }
if (!found) { if (!found) {
mutex_unlock(&local->mtx);
return -ENOENT; return -ENOENT;
} }
...@@ -721,7 +714,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -721,7 +714,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
if (local->ops->remain_on_channel) { if (local->ops->remain_on_channel) {
ret = drv_cancel_remain_on_channel(local, roc->sdata); ret = drv_cancel_remain_on_channel(local, roc->sdata);
if (WARN_ON_ONCE(ret)) { if (WARN_ON_ONCE(ret)) {
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -749,7 +741,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local, ...@@ -749,7 +741,6 @@ static int ieee80211_cancel_roc(struct ieee80211_local *local,
} }
out_unlock: out_unlock:
mutex_unlock(&local->mtx);
return 0; return 0;
} }
...@@ -778,6 +769,8 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -778,6 +769,8 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
int ret; int ret;
u8 *data; u8 *data;
lockdep_assert_wiphy(local->hw.wiphy);
if (params->dont_wait_for_ack) if (params->dont_wait_for_ack)
flags = IEEE80211_TX_CTL_NO_ACK; flags = IEEE80211_TX_CTL_NO_ACK;
else else
...@@ -855,8 +848,6 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -855,8 +848,6 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
if (need_offchan && !params->chan) if (need_offchan && !params->chan)
return -EINVAL; return -EINVAL;
mutex_lock(&local->mtx);
/* Check if the operating channel is the requested channel */ /* Check if the operating channel is the requested channel */
if (!params->chan && mlo_sta) { if (!params->chan && mlo_sta) {
need_offchan = false; need_offchan = false;
...@@ -980,7 +971,6 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, ...@@ -980,7 +971,6 @@ int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
if (ret) if (ret)
ieee80211_free_txskb(&local->hw, skb); ieee80211_free_txskb(&local->hw, skb);
out_unlock: out_unlock:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -1006,7 +996,8 @@ void ieee80211_roc_purge(struct ieee80211_local *local, ...@@ -1006,7 +996,8 @@ void ieee80211_roc_purge(struct ieee80211_local *local,
struct ieee80211_roc_work *roc, *tmp; struct ieee80211_roc_work *roc, *tmp;
bool work_to_do = false; bool work_to_do = false;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry_safe(roc, tmp, &local->roc_list, list) { list_for_each_entry_safe(roc, tmp, &local->roc_list, list) {
if (sdata && roc->sdata != sdata) if (sdata && roc->sdata != sdata)
continue; continue;
...@@ -1026,5 +1017,4 @@ void ieee80211_roc_purge(struct ieee80211_local *local, ...@@ -1026,5 +1017,4 @@ void ieee80211_roc_purge(struct ieee80211_local *local,
} }
if (work_to_do) if (work_to_do)
__ieee80211_roc_work(local); __ieee80211_roc_work(local);
mutex_unlock(&local->mtx);
} }
...@@ -344,7 +344,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata) ...@@ -344,7 +344,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)
u32 flags = 0; u32 flags = 0;
req = rcu_dereference_protected(local->scan_req, req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (test_bit(SCAN_HW_CANCELLED, &local->scanning)) if (test_bit(SCAN_HW_CANCELLED, &local->scanning))
return false; return false;
...@@ -409,7 +409,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) ...@@ -409,7 +409,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
struct ieee80211_sub_if_data *scan_sdata; struct ieee80211_sub_if_data *scan_sdata;
struct ieee80211_sub_if_data *sdata; struct ieee80211_sub_if_data *sdata;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* /*
* It's ok to abort a not-yet-running scan (that * It's ok to abort a not-yet-running scan (that
...@@ -424,7 +424,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) ...@@ -424,7 +424,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
return; return;
scan_sdata = rcu_dereference_protected(local->scan_sdata, scan_sdata = rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (hw_scan && !aborted && if (hw_scan && !aborted &&
!ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) && !ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS) &&
...@@ -433,7 +433,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) ...@@ -433,7 +433,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
rc = drv_hw_scan(local, rc = drv_hw_scan(local,
rcu_dereference_protected(local->scan_sdata, rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx)), lockdep_is_held(&local->hw.wiphy->mtx)),
local->hw_scan_req); local->hw_scan_req);
if (rc == 0) if (rc == 0)
...@@ -450,7 +450,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted) ...@@ -450,7 +450,7 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
local->hw_scan_req = NULL; local->hw_scan_req = NULL;
scan_req = rcu_dereference_protected(local->scan_req, scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
RCU_INIT_POINTER(local->scan_req, NULL); RCU_INIT_POINTER(local->scan_req, NULL);
RCU_INIT_POINTER(local->scan_sdata, NULL); RCU_INIT_POINTER(local->scan_sdata, NULL);
...@@ -591,7 +591,7 @@ static bool ieee80211_can_scan(struct ieee80211_local *local, ...@@ -591,7 +591,7 @@ static bool ieee80211_can_scan(struct ieee80211_local *local,
void ieee80211_run_deferred_scan(struct ieee80211_local *local) void ieee80211_run_deferred_scan(struct ieee80211_local *local)
{ {
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!local->scan_req || local->scanning) if (!local->scan_req || local->scanning)
return; return;
...@@ -599,7 +599,7 @@ void ieee80211_run_deferred_scan(struct ieee80211_local *local) ...@@ -599,7 +599,7 @@ void ieee80211_run_deferred_scan(struct ieee80211_local *local)
if (!ieee80211_can_scan(local, if (!ieee80211_can_scan(local,
rcu_dereference_protected( rcu_dereference_protected(
local->scan_sdata, local->scan_sdata,
lockdep_is_held(&local->mtx)))) lockdep_is_held(&local->hw.wiphy->mtx))))
return; return;
wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
...@@ -644,7 +644,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, ...@@ -644,7 +644,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
u32 flags = 0, tx_flags; u32 flags = 0, tx_flags;
scan_req = rcu_dereference_protected(local->scan_req, scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
tx_flags = IEEE80211_TX_INTFL_OFFCHAN_TX_OK; tx_flags = IEEE80211_TX_INTFL_OFFCHAN_TX_OK;
if (scan_req->no_cck) if (scan_req->no_cck)
...@@ -655,7 +655,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, ...@@ -655,7 +655,7 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local,
flags |= IEEE80211_PROBE_FLAG_RANDOM_SN; flags |= IEEE80211_PROBE_FLAG_RANDOM_SN;
sdata = rcu_dereference_protected(local->scan_sdata, sdata = rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
for (i = 0; i < scan_req->n_ssids; i++) for (i = 0; i < scan_req->n_ssids; i++)
ieee80211_send_scan_probe_req( ieee80211_send_scan_probe_req(
...@@ -680,7 +680,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata, ...@@ -680,7 +680,7 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
bool hw_scan = local->ops->hw_scan; bool hw_scan = local->ops->hw_scan;
int rc; int rc;
lockdep_assert_held(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (local->scan_req) if (local->scan_req)
return -EBUSY; return -EBUSY;
...@@ -884,7 +884,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local, ...@@ -884,7 +884,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
mutex_unlock(&local->iflist_mtx); mutex_unlock(&local->iflist_mtx);
scan_req = rcu_dereference_protected(local->scan_req, scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
next_chan = scan_req->channels[local->scan_channel_idx]; next_chan = scan_req->channels[local->scan_channel_idx];
...@@ -925,7 +925,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local, ...@@ -925,7 +925,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
struct cfg80211_scan_request *scan_req; struct cfg80211_scan_request *scan_req;
scan_req = rcu_dereference_protected(local->scan_req, scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
skip = 0; skip = 0;
chan = scan_req->channels[local->scan_channel_idx]; chan = scan_req->channels[local->scan_channel_idx];
...@@ -1051,7 +1051,7 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -1051,7 +1051,7 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work)
unsigned long next_delay = 0; unsigned long next_delay = 0;
bool aborted; bool aborted;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!ieee80211_can_run_worker(local)) { if (!ieee80211_can_run_worker(local)) {
aborted = true; aborted = true;
...@@ -1059,9 +1059,9 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -1059,9 +1059,9 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work)
} }
sdata = rcu_dereference_protected(local->scan_sdata, sdata = rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
scan_req = rcu_dereference_protected(local->scan_req, scan_req = rcu_dereference_protected(local->scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
/* When scanning on-channel, the first-callback means completed. */ /* When scanning on-channel, the first-callback means completed. */
if (test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning)) { if (test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning)) {
...@@ -1075,7 +1075,7 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -1075,7 +1075,7 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work)
} }
if (!sdata || !scan_req) if (!sdata || !scan_req)
goto out; return;
if (!local->scanning) { if (!local->scanning) {
int rc; int rc;
...@@ -1084,13 +1084,12 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -1084,13 +1084,12 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work)
RCU_INIT_POINTER(local->scan_sdata, NULL); RCU_INIT_POINTER(local->scan_sdata, NULL);
rc = __ieee80211_start_scan(sdata, scan_req); rc = __ieee80211_start_scan(sdata, scan_req);
if (rc) { if (!rc)
/* need to complete scan in cfg80211 */ return;
rcu_assign_pointer(local->scan_req, scan_req); /* need to complete scan in cfg80211 */
aborted = true; rcu_assign_pointer(local->scan_req, scan_req);
goto out_complete; aborted = true;
} else goto out_complete;
goto out;
} }
clear_bit(SCAN_BEACON_WAIT, &local->scanning); clear_bit(SCAN_BEACON_WAIT, &local->scanning);
...@@ -1138,24 +1137,18 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work) ...@@ -1138,24 +1137,18 @@ void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work)
wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work, wiphy_delayed_work_queue(local->hw.wiphy, &local->scan_work,
next_delay); next_delay);
goto out; return;
out_complete: out_complete:
__ieee80211_scan_completed(&local->hw, aborted); __ieee80211_scan_completed(&local->hw, aborted);
out:
mutex_unlock(&local->mtx);
} }
int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
struct cfg80211_scan_request *req) struct cfg80211_scan_request *req)
{ {
int res; lockdep_assert_wiphy(sdata->local->hw.wiphy);
mutex_lock(&sdata->local->mtx); return __ieee80211_start_scan(sdata, req);
res = __ieee80211_start_scan(sdata, req);
mutex_unlock(&sdata->local->mtx);
return res;
} }
int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
...@@ -1168,7 +1161,7 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, ...@@ -1168,7 +1161,7 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
int ret = -EBUSY, i, n_ch = 0; int ret = -EBUSY, i, n_ch = 0;
enum nl80211_band band; enum nl80211_band band;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* busy scanning */ /* busy scanning */
if (local->scan_req) if (local->scan_req)
...@@ -1225,7 +1218,6 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, ...@@ -1225,7 +1218,6 @@ int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req); ret = __ieee80211_start_scan(sdata, sdata->local->int_scan_req);
unlock: unlock:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -1252,9 +1244,8 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) ...@@ -1252,9 +1244,8 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
* after the scan was completed/aborted. * after the scan was completed/aborted.
*/ */
mutex_lock(&local->mtx);
if (!local->scan_req) if (!local->scan_req)
goto out; return;
/* /*
* We have a scan running and the driver already reported completion, * We have a scan running and the driver already reported completion,
...@@ -1264,7 +1255,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) ...@@ -1264,7 +1255,7 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
if (test_bit(SCAN_HW_SCANNING, &local->scanning) && if (test_bit(SCAN_HW_SCANNING, &local->scanning) &&
test_bit(SCAN_COMPLETED, &local->scanning)) { test_bit(SCAN_COMPLETED, &local->scanning)) {
set_bit(SCAN_HW_CANCELLED, &local->scanning); set_bit(SCAN_HW_CANCELLED, &local->scanning);
goto out; return;
} }
if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { if (test_bit(SCAN_HW_SCANNING, &local->scanning)) {
...@@ -1276,16 +1267,14 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) ...@@ -1276,16 +1267,14 @@ void ieee80211_scan_cancel(struct ieee80211_local *local)
if (local->ops->cancel_hw_scan) if (local->ops->cancel_hw_scan)
drv_cancel_hw_scan(local, drv_cancel_hw_scan(local,
rcu_dereference_protected(local->scan_sdata, rcu_dereference_protected(local->scan_sdata,
lockdep_is_held(&local->mtx))); lockdep_is_held(&local->hw.wiphy->mtx)));
goto out; return;
} }
wiphy_delayed_work_cancel(local->hw.wiphy, &local->scan_work); wiphy_delayed_work_cancel(local->hw.wiphy, &local->scan_work);
/* and clean up */ /* and clean up */
memset(&local->scan_info, 0, sizeof(local->scan_info)); memset(&local->scan_info, 0, sizeof(local->scan_info));
__ieee80211_scan_completed(&local->hw, true); __ieee80211_scan_completed(&local->hw, true);
out:
mutex_unlock(&local->mtx);
} }
int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
...@@ -1300,9 +1289,9 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, ...@@ -1300,9 +1289,9 @@ int __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
u8 *ie; u8 *ie;
u32 flags = 0; u32 flags = 0;
iebufsz = local->scan_ies_len + req->ie_len; lockdep_assert_wiphy(local->hw.wiphy);
lockdep_assert_held(&local->mtx); iebufsz = local->scan_ies_len + req->ie_len;
if (!local->ops->sched_scan_start) if (!local->ops->sched_scan_start)
return -ENOTSUPP; return -ENOTSUPP;
...@@ -1353,19 +1342,13 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, ...@@ -1353,19 +1342,13 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
struct cfg80211_sched_scan_request *req) struct cfg80211_sched_scan_request *req)
{ {
struct ieee80211_local *local = sdata->local; struct ieee80211_local *local = sdata->local;
int ret;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (rcu_access_pointer(local->sched_scan_sdata)) { if (rcu_access_pointer(local->sched_scan_sdata))
mutex_unlock(&local->mtx);
return -EBUSY; return -EBUSY;
}
ret = __ieee80211_request_sched_scan_start(sdata, req);
mutex_unlock(&local->mtx); return __ieee80211_request_sched_scan_start(sdata, req);
return ret;
} }
int ieee80211_request_sched_scan_stop(struct ieee80211_local *local) int ieee80211_request_sched_scan_stop(struct ieee80211_local *local)
...@@ -1373,25 +1356,21 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_local *local) ...@@ -1373,25 +1356,21 @@ int ieee80211_request_sched_scan_stop(struct ieee80211_local *local)
struct ieee80211_sub_if_data *sched_scan_sdata; struct ieee80211_sub_if_data *sched_scan_sdata;
int ret = -ENOENT; int ret = -ENOENT;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!local->ops->sched_scan_stop) { if (!local->ops->sched_scan_stop)
ret = -ENOTSUPP; return -ENOTSUPP;
goto out;
}
/* We don't want to restart sched scan anymore. */ /* We don't want to restart sched scan anymore. */
RCU_INIT_POINTER(local->sched_scan_req, NULL); RCU_INIT_POINTER(local->sched_scan_req, NULL);
sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (sched_scan_sdata) { if (sched_scan_sdata) {
ret = drv_sched_scan_stop(local, sched_scan_sdata); ret = drv_sched_scan_stop(local, sched_scan_sdata);
if (!ret) if (!ret)
RCU_INIT_POINTER(local->sched_scan_sdata, NULL); RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
} }
out:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -1408,20 +1387,16 @@ EXPORT_SYMBOL(ieee80211_sched_scan_results); ...@@ -1408,20 +1387,16 @@ EXPORT_SYMBOL(ieee80211_sched_scan_results);
void ieee80211_sched_scan_end(struct ieee80211_local *local) void ieee80211_sched_scan_end(struct ieee80211_local *local)
{ {
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!rcu_access_pointer(local->sched_scan_sdata)) { if (!rcu_access_pointer(local->sched_scan_sdata))
mutex_unlock(&local->mtx);
return; return;
}
RCU_INIT_POINTER(local->sched_scan_sdata, NULL); RCU_INIT_POINTER(local->sched_scan_sdata, NULL);
/* If sched scan was aborted by the driver. */ /* If sched scan was aborted by the driver. */
RCU_INIT_POINTER(local->sched_scan_req, NULL); RCU_INIT_POINTER(local->sched_scan_req, NULL);
mutex_unlock(&local->mtx);
cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0);
} }
......
...@@ -30,13 +30,13 @@ void ieee80211_tdls_peer_del_work(struct wiphy *wiphy, struct wiphy_work *wk) ...@@ -30,13 +30,13 @@ void ieee80211_tdls_peer_del_work(struct wiphy *wiphy, struct wiphy_work *wk)
u.mgd.tdls_peer_del_work.work); u.mgd.tdls_peer_del_work.work);
local = sdata->local; local = sdata->local;
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer)) { if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer)) {
tdls_dbg(sdata, "TDLS del peer %pM\n", sdata->u.mgd.tdls_peer); tdls_dbg(sdata, "TDLS del peer %pM\n", sdata->u.mgd.tdls_peer);
sta_info_destroy_addr(sdata, sdata->u.mgd.tdls_peer); sta_info_destroy_addr(sdata, sdata->u.mgd.tdls_peer);
eth_zero_addr(sdata->u.mgd.tdls_peer); eth_zero_addr(sdata->u.mgd.tdls_peer);
} }
mutex_unlock(&local->mtx);
} }
static void ieee80211_tdls_add_ext_capab(struct ieee80211_link_data *link, static void ieee80211_tdls_add_ext_capab(struct ieee80211_link_data *link,
...@@ -1180,7 +1180,7 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, ...@@ -1180,7 +1180,7 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
return -ENOTSUPP; return -ENOTSUPP;
} }
mutex_lock(&local->mtx); lockdep_assert_wiphy(local->hw.wiphy);
/* we don't support concurrent TDLS peer setups */ /* we don't support concurrent TDLS peer setups */
if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer) && if (!is_zero_ether_addr(sdata->u.mgd.tdls_peer) &&
...@@ -1208,7 +1208,6 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, ...@@ -1208,7 +1208,6 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
ieee80211_flush_queues(local, sdata, false); ieee80211_flush_queues(local, sdata, false);
memcpy(sdata->u.mgd.tdls_peer, peer, ETH_ALEN); memcpy(sdata->u.mgd.tdls_peer, peer, ETH_ALEN);
mutex_unlock(&local->mtx);
/* we cannot take the mutex while preparing the setup packet */ /* we cannot take the mutex while preparing the setup packet */
ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer, ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer,
...@@ -1218,9 +1217,7 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, ...@@ -1218,9 +1217,7 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
extra_ies, extra_ies_len, 0, extra_ies, extra_ies_len, 0,
NULL); NULL);
if (ret < 0) { if (ret < 0) {
mutex_lock(&local->mtx);
eth_zero_addr(sdata->u.mgd.tdls_peer); eth_zero_addr(sdata->u.mgd.tdls_peer);
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -1230,7 +1227,6 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev, ...@@ -1230,7 +1227,6 @@ ieee80211_tdls_mgmt_setup(struct wiphy *wiphy, struct net_device *dev,
return 0; return 0;
out_unlock: out_unlock:
mutex_unlock(&local->mtx);
return ret; return ret;
} }
...@@ -1470,7 +1466,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1470,7 +1466,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
* ieee80211_bss_info_change_notify() * ieee80211_bss_info_change_notify()
*/ */
sdata_lock(sdata); sdata_lock(sdata);
mutex_lock(&local->mtx);
tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer); tdls_dbg(sdata, "TDLS oper %d peer %pM\n", oper, peer);
switch (oper) { switch (oper) {
...@@ -1532,7 +1527,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, ...@@ -1532,7 +1527,6 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
wiphy_work_queue(sdata->local->hw.wiphy, wiphy_work_queue(sdata->local->hw.wiphy,
&sdata->deflink.u.mgd.request_smps_work); &sdata->deflink.u.mgd.request_smps_work);
mutex_unlock(&local->mtx);
sdata_unlock(sdata); sdata_unlock(sdata);
return ret; return ret;
} }
......
...@@ -6109,6 +6109,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, ...@@ -6109,6 +6109,9 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
u32 flags = 0; u32 flags = 0;
int err; int err;
/* mutex lock is only needed for incrementing the cookie counter */
lockdep_assert_wiphy(local->hw.wiphy);
/* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE /* Only accept CONTROL_PORT_PROTOCOL configured in CONNECT/ASSOCIATE
* or Pre-Authentication * or Pre-Authentication
*/ */
...@@ -6199,15 +6202,10 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, ...@@ -6199,15 +6202,10 @@ int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
rcu_read_unlock(); rcu_read_unlock();
start_xmit: start_xmit:
/* mutex lock is only needed for incrementing the cookie counter */
mutex_lock(&local->mtx);
local_bh_disable(); local_bh_disable();
__ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie); __ieee80211_subif_start_xmit(skb, skb->dev, flags, ctrl_flags, cookie);
local_bh_enable(); local_bh_enable();
mutex_unlock(&local->mtx);
return 0; return 0;
} }
......
...@@ -2861,11 +2861,10 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2861,11 +2861,10 @@ int ieee80211_reconfig(struct ieee80211_local *local)
ieee80211_reenable_keys(sdata); ieee80211_reenable_keys(sdata);
/* Reconfigure sched scan if it was interrupted by FW restart */ /* Reconfigure sched scan if it was interrupted by FW restart */
mutex_lock(&local->mtx);
sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata, sched_scan_sdata = rcu_dereference_protected(local->sched_scan_sdata,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
sched_scan_req = rcu_dereference_protected(local->sched_scan_req, sched_scan_req = rcu_dereference_protected(local->sched_scan_req,
lockdep_is_held(&local->mtx)); lockdep_is_held(&local->hw.wiphy->mtx));
if (sched_scan_sdata && sched_scan_req) if (sched_scan_sdata && sched_scan_req)
/* /*
* Sched scan stopped, but we don't want to report it. Instead, * Sched scan stopped, but we don't want to report it. Instead,
...@@ -2881,7 +2880,6 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2881,7 +2880,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
RCU_INIT_POINTER(local->sched_scan_req, NULL); RCU_INIT_POINTER(local->sched_scan_req, NULL);
sched_scan_stopped = true; sched_scan_stopped = true;
} }
mutex_unlock(&local->mtx);
if (sched_scan_stopped) if (sched_scan_stopped)
cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0); cfg80211_sched_scan_stopped_locked(local->hw.wiphy, 0);
...@@ -2923,9 +2921,7 @@ int ieee80211_reconfig(struct ieee80211_local *local) ...@@ -2923,9 +2921,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
barrier(); barrier();
/* Restart deferred ROCs */ /* Restart deferred ROCs */
mutex_lock(&local->mtx);
ieee80211_start_next_roc(local); ieee80211_start_next_roc(local);
mutex_unlock(&local->mtx);
/* Requeue all works */ /* Requeue all works */
list_for_each_entry(sdata, &local->interfaces, list) list_for_each_entry(sdata, &local->interfaces, list)
...@@ -4329,7 +4325,6 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) ...@@ -4329,7 +4325,6 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
/* for interface list, to avoid linking iflist_mtx and chanctx_mtx */ /* for interface list, to avoid linking iflist_mtx and chanctx_mtx */
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
mutex_lock(&local->mtx);
list_for_each_entry(sdata, &local->interfaces, list) { list_for_each_entry(sdata, &local->interfaces, list) {
/* it might be waiting for the local->mtx, but then /* it might be waiting for the local->mtx, but then
* by the time it gets it, sdata->wdev.cac_started * by the time it gets it, sdata->wdev.cac_started
...@@ -4347,7 +4342,6 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local) ...@@ -4347,7 +4342,6 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
GFP_KERNEL); GFP_KERNEL);
} }
} }
mutex_unlock(&local->mtx);
} }
void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
...@@ -4360,6 +4354,7 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy, ...@@ -4360,6 +4354,7 @@ void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
int num_chanctx = 0; int num_chanctx = 0;
lockdep_assert_wiphy(local->hw.wiphy); lockdep_assert_wiphy(local->hw.wiphy);
list_for_each_entry(ctx, &local->chanctx_list, list) { list_for_each_entry(ctx, &local->chanctx_list, list) {
if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER) if (ctx->replace_state == IEEE80211_CHANCTX_REPLACES_OTHER)
continue; continue;
......
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