Skip to contentSkip to conversation

mac80211: fix station rate table updates on assoc

PATCH New Felix Fietkau 1 participant 1 message Feb 1, 2021 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix station rate table updates on assoc

If the driver uses .sta_add, station entries are only uploaded after the sta is in assoc state. Fix early station rate table updates by deferring them until the sta has been uploaded

---
 net/mac80211/driver-ops.c | 5 ++++-
 net/mac80211/rate.c       | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)
net/mac80211/driver-ops.c +4 -1
index c9a8a2433e8a..a1f879cd53fe 100644
@@ -125,8 +125,11 @@ int drv_sta_state(struct ieee80211_local *local,
 	} else if (old_state == IEEE80211_STA_AUTH &&
 		   new_state == IEEE80211_STA_ASSOC) {
 		ret = drv_sta_add(local, sdata, &sta->sta);
-		if (ret == 0)
+		if (ret == 0) {
 			sta->uploaded = true;
+			if (rcu_dereference(sta->sta.rates))
+				drv_sta_rate_tbl_update(local, sdata, &sta->sta);
+		}
 	} else if (old_state == IEEE80211_STA_ASSOC &&
 		   new_state == IEEE80211_STA_AUTH) {
 		drv_sta_remove(local, sdata, &sta->sta);
net/mac80211/rate.c +2 -1
index 45927202c71c..63652c39c8e0 100644
@@ -960,7 +960,8 @@ int rate_control_set_rates(struct ieee80211_hw *hw,
 	if (old)
 		kfree_rcu(old, rcu_head);
 
-	drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta);
+	if (sta->uploaded)
+		drv_sta_rate_tbl_update(hw_to_local(hw), sta->sdata, pubsta);
 
 	ieee80211_sta_set_expected_throughput(pubsta, sta_get_expected_throughput(sta));
 
Signature · 1 line
2.28.0