LinuxKPI: 802.11: sync sta->addr in lkpi_iv_update_bss()

In lkpi_iv_update_bss() introduced in d9f59799fc we swap lsta and
along with that sta and drv state if ni gets reused and swapped under
us by net80211.  What we did not do was to sync sta->addr which later
(usually in lkpi_sta_assoc_to_run) during a bss_info update cause
problems in drivers (or firmware) as the BSSID and the station address
were not aligned.

If this proves to hold up to fix iwlwifi issues seem on firmware
for older chipsets, multi-assoc runs, and rtw89 (which this fixes)
we should add asserts that lkpi_iv_update_bss() can only happen in
pre-auth stages and/or make sure we factor out synching more state
fields.

Found debugging:	rtw89
MFC after:		3 days
This commit is contained in:
Bjoern A. Zeeb 2022-06-26 19:04:16 +00:00
parent 9597f7cb99
commit ed3ef56b29

View File

@ -2073,8 +2073,8 @@ lkpi_iv_update_bss(struct ieee80211vap *vap, struct ieee80211_node *ni)
struct lkpi_vif *lvif;
struct ieee80211_node *obss;
struct lkpi_sta *lsta;
struct ieee80211_sta *sta;
lvif = VAP_TO_LVIF(vap);
obss = vap->iv_bss;
#ifdef LINUXKPI_DEBUG_80211
@ -2101,13 +2101,20 @@ lkpi_iv_update_bss(struct ieee80211vap *vap, struct ieee80211_node *ni)
lsta = obss->ni_drv_data;
obss->ni_drv_data = ni->ni_drv_data;
ni->ni_drv_data = lsta;
if (lsta != NULL)
if (lsta != NULL) {
lsta->ni = ni;
sta = LSTA_TO_STA(lsta);
IEEE80211_ADDR_COPY(sta->addr, lsta->ni->ni_macaddr);
}
lsta = obss->ni_drv_data;
if (lsta != NULL)
if (lsta != NULL) {
lsta->ni = obss;
sta = LSTA_TO_STA(lsta);
IEEE80211_ADDR_COPY(sta->addr, lsta->ni->ni_macaddr);
}
out:
lvif = VAP_TO_LVIF(vap);
return (lvif->iv_update_bss(vap, ni));
}