Commit 6858ad75 authored by Johannes Berg's avatar Johannes Berg

wifi: mac80211: consistently use sdata_dereference()

Instead of open-coding it, use sdata_dereference().
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 912fa56b
...@@ -255,8 +255,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, ...@@ -255,8 +255,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
drv_leave_ibss(local, sdata); drv_leave_ibss(local, sdata);
} }
presp = rcu_dereference_protected(ifibss->presp, presp = sdata_dereference(ifibss->presp, sdata);
lockdep_is_held(&sdata->wdev.mtx));
RCU_INIT_POINTER(ifibss->presp, NULL); RCU_INIT_POINTER(ifibss->presp, NULL);
if (presp) if (presp)
kfree_rcu(presp, rcu_head); kfree_rcu(presp, rcu_head);
...@@ -509,8 +508,7 @@ int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata, ...@@ -509,8 +508,7 @@ int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
rcu_read_unlock(); rcu_read_unlock();
cfg80211_put_bss(sdata->local->hw.wiphy, cbss); cfg80211_put_bss(sdata->local->hw.wiphy, cbss);
old_presp = rcu_dereference_protected(ifibss->presp, old_presp = sdata_dereference(ifibss->presp, sdata);
lockdep_is_held(&sdata->wdev.mtx));
presp = ieee80211_ibss_build_presp(sdata, presp = ieee80211_ibss_build_presp(sdata,
sdata->vif.bss_conf.beacon_int, sdata->vif.bss_conf.beacon_int,
...@@ -714,8 +712,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata) ...@@ -714,8 +712,7 @@ static void ieee80211_ibss_disconnect(struct ieee80211_sub_if_data *sdata)
sdata->vif.cfg.ssid_len = 0; sdata->vif.cfg.ssid_len = 0;
/* remove beacon */ /* remove beacon */
presp = rcu_dereference_protected(ifibss->presp, presp = sdata_dereference(ifibss->presp, sdata);
lockdep_is_held(&sdata->wdev.mtx));
RCU_INIT_POINTER(sdata->u.ibss.presp, NULL); RCU_INIT_POINTER(sdata->u.ibss.presp, NULL);
if (presp) if (presp)
kfree_rcu(presp, rcu_head); kfree_rcu(presp, rcu_head);
...@@ -1530,8 +1527,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata, ...@@ -1530,8 +1527,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
sdata_assert_lock(sdata); sdata_assert_lock(sdata);
presp = rcu_dereference_protected(ifibss->presp, presp = sdata_dereference(ifibss->presp, sdata);
lockdep_is_held(&sdata->wdev.mtx));
if (ifibss->state != IEEE80211_IBSS_MLME_JOINED || if (ifibss->state != IEEE80211_IBSS_MLME_JOINED ||
len < 24 + 2 || !presp) len < 24 + 2 || !presp)
......
...@@ -993,8 +993,7 @@ ieee80211_mesh_rebuild_beacon(struct ieee80211_sub_if_data *sdata) ...@@ -993,8 +993,7 @@ ieee80211_mesh_rebuild_beacon(struct ieee80211_sub_if_data *sdata)
struct beacon_data *old_bcn; struct beacon_data *old_bcn;
int ret; int ret;
old_bcn = rcu_dereference_protected(sdata->u.mesh.beacon, old_bcn = sdata_dereference(sdata->u.mesh.beacon, sdata);
lockdep_is_held(&sdata->wdev.mtx));
ret = ieee80211_mesh_build_beacon(&sdata->u.mesh); ret = ieee80211_mesh_build_beacon(&sdata->u.mesh);
if (ret) if (ret)
/* just reuse old beacon */ /* just reuse old beacon */
...@@ -1084,8 +1083,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata) ...@@ -1084,8 +1083,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
ieee80211_link_info_change_notify(sdata, 0, BSS_CHANGED_BEACON_ENABLED); ieee80211_link_info_change_notify(sdata, 0, BSS_CHANGED_BEACON_ENABLED);
/* remove beacon */ /* remove beacon */
bcn = rcu_dereference_protected(ifmsh->beacon, bcn = sdata_dereference(ifmsh->beacon, sdata);
lockdep_is_held(&sdata->wdev.mtx));
RCU_INIT_POINTER(ifmsh->beacon, NULL); RCU_INIT_POINTER(ifmsh->beacon, NULL);
kfree_rcu(bcn, rcu_head); kfree_rcu(bcn, rcu_head);
...@@ -1380,8 +1378,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata) ...@@ -1380,8 +1378,7 @@ int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata)
ifmsh->chsw_ttl = 0; ifmsh->chsw_ttl = 0;
/* Remove the CSA and MCSP elements from the beacon */ /* Remove the CSA and MCSP elements from the beacon */
tmp_csa_settings = rcu_dereference_protected(ifmsh->csa, tmp_csa_settings = sdata_dereference(ifmsh->csa, sdata);
lockdep_is_held(&sdata->wdev.mtx));
RCU_INIT_POINTER(ifmsh->csa, NULL); RCU_INIT_POINTER(ifmsh->csa, NULL);
if (tmp_csa_settings) if (tmp_csa_settings)
kfree_rcu(tmp_csa_settings, rcu_head); kfree_rcu(tmp_csa_settings, rcu_head);
......
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