Commit 895e861d authored by Felix Fietkau's avatar Felix Fietkau Committed by Greg Kroah-Hartman

ath9k: fix using sta->drv_priv before initializing it

commit 7711aaf0 upstream.

A station pointer can be passed to the driver on tx, before it has been
marked as associated. Since ath9k_sta_state was initializing the entry
too late, it resulted in some spurious crashes.

Fixes: df3c6eb3 ("ath9k: Use sta_state() callback")
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 94d9f078
...@@ -1552,13 +1552,13 @@ static int ath9k_sta_state(struct ieee80211_hw *hw, ...@@ -1552,13 +1552,13 @@ static int ath9k_sta_state(struct ieee80211_hw *hw,
struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_common *common = ath9k_hw_common(sc->sc_ah);
int ret = 0; int ret = 0;
if (old_state == IEEE80211_STA_AUTH && if (old_state == IEEE80211_STA_NOTEXIST &&
new_state == IEEE80211_STA_ASSOC) { new_state == IEEE80211_STA_NONE) {
ret = ath9k_sta_add(hw, vif, sta); ret = ath9k_sta_add(hw, vif, sta);
ath_dbg(common, CONFIG, ath_dbg(common, CONFIG,
"Add station: %pM\n", sta->addr); "Add station: %pM\n", sta->addr);
} else if (old_state == IEEE80211_STA_ASSOC && } else if (old_state == IEEE80211_STA_NONE &&
new_state == IEEE80211_STA_AUTH) { new_state == IEEE80211_STA_NOTEXIST) {
ret = ath9k_sta_remove(hw, vif, sta); ret = ath9k_sta_remove(hw, vif, sta);
ath_dbg(common, CONFIG, ath_dbg(common, CONFIG,
"Remove station: %pM\n", sta->addr); "Remove station: %pM\n", sta->addr);
......
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