Skip to content

Commit 48c5d82

Browse files
committed
wifi: mac80211: call drv_sta_state() under sdata_lock() in reconfig
Currently, other paths calling drv_sta_state() hold the mutex and therefore drivers can assume that, and look at links with that protection. Fix that for the reconfig path as well; to do it more easily use ieee80211_reconfig_stations() for the AP/AP_VLAN station reconfig as well. Signed-off-by: Johannes Berg <[email protected]>
1 parent 6522047 commit 48c5d82

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

net/mac80211/util.c

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2530,7 +2530,6 @@ int ieee80211_reconfig(struct ieee80211_local *local)
25302530
if (link)
25312531
ieee80211_assign_chanctx(local, sdata, link);
25322532
}
2533-
sdata_unlock(sdata);
25342533

25352534
switch (sdata->vif.type) {
25362535
case NL80211_IFTYPE_AP_VLAN:
@@ -2549,6 +2548,7 @@ int ieee80211_reconfig(struct ieee80211_local *local)
25492548
&sdata->deflink.tx_conf[i]);
25502549
break;
25512550
}
2551+
sdata_unlock(sdata);
25522552

25532553
/* common change flags for all interface types */
25542554
changed = BSS_CHANGED_ERP_CTS_PROT |
@@ -2657,23 +2657,21 @@ int ieee80211_reconfig(struct ieee80211_local *local)
26572657
}
26582658

26592659
/* APs are now beaconing, add back stations */
2660-
mutex_lock(&local->sta_mtx);
2661-
list_for_each_entry(sta, &local->sta_list, list) {
2662-
enum ieee80211_sta_state state;
2663-
2664-
if (!sta->uploaded)
2665-
continue;
2666-
2667-
if (sta->sdata->vif.type != NL80211_IFTYPE_AP &&
2668-
sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN)
2660+
list_for_each_entry(sdata, &local->interfaces, list) {
2661+
if (!ieee80211_sdata_running(sdata))
26692662
continue;
26702663

2671-
for (state = IEEE80211_STA_NOTEXIST;
2672-
state < sta->sta_state; state++)
2673-
WARN_ON(drv_sta_state(local, sta->sdata, sta, state,
2674-
state + 1));
2664+
sdata_lock(sdata);
2665+
switch (sdata->vif.type) {
2666+
case NL80211_IFTYPE_AP_VLAN:
2667+
case NL80211_IFTYPE_AP:
2668+
ieee80211_reconfig_stations(sdata);
2669+
break;
2670+
default:
2671+
break;
2672+
}
2673+
sdata_unlock(sdata);
26752674
}
2676-
mutex_unlock(&local->sta_mtx);
26772675

26782676
/* add back keys */
26792677
list_for_each_entry(sdata, &local->interfaces, list)

0 commit comments

Comments
 (0)