Skip to content

Commit 4ef69d0

Browse files
Felix Fietkaulinvjw
authored andcommitted
ath9k: fix key allocation error handling for powersave keys
If no keycache slots are available, ath_key_config can return -ENOSPC. If the key index is not checked for errors, it can lead to logspam that looks like this: "ath: wiphy0: keyreset: keycache entry 228 out of range" This can cause follow-up errors if the invalid keycache index gets used for tx. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent a8a48e6 commit 4ef69d0

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

  • drivers/net/wireless/ath/ath9k

‎drivers/net/wireless/ath/ath9k/main.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,14 +1332,17 @@ static int ath9k_sta_add(struct ieee80211_hw *hw,
13321332
struct ath_common *common = ath9k_hw_common(sc->sc_ah);
13331333
struct ath_node *an = (struct ath_node *) sta->drv_priv;
13341334
struct ieee80211_key_conf ps_key = { };
1335+
int key;
13351336

13361337
ath_node_attach(sc, sta, vif);
13371338

13381339
if (vif->type != NL80211_IFTYPE_AP &&
13391340
vif->type != NL80211_IFTYPE_AP_VLAN)
13401341
return 0;
13411342

1342-
an->ps_key = ath_key_config(common, vif, sta, &ps_key);
1343+
key = ath_key_config(common, vif, sta, &ps_key);
1344+
if (key > 0)
1345+
an->ps_key = key;
13431346

13441347
return 0;
13451348
}
@@ -1356,6 +1359,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc,
13561359
return;
13571360

13581361
ath_key_delete(common, &ps_key);
1362+
an->ps_key = 0;
13591363
}
13601364

13611365
static int ath9k_sta_remove(struct ieee80211_hw *hw,

0 commit comments

Comments
 (0)