diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-04-27 05:47:01 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-05-03 13:44:56 -0400 |
commit | 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 (patch) | |
tree | 89ef58c65e22609f631771501e66070b6220de5a /drivers/net/wireless/ath/ath9k | |
parent | a8a48e60a468084ef6ec23c78e8903c9e0ba7a4c (diff) |
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>
Diffstat (limited to 'drivers/net/wireless/ath/ath9k')
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 6963862a1872..c4fc3d14ea62 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1332,6 +1332,7 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, | |||
1332 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); | 1332 | struct ath_common *common = ath9k_hw_common(sc->sc_ah); |
1333 | struct ath_node *an = (struct ath_node *) sta->drv_priv; | 1333 | struct ath_node *an = (struct ath_node *) sta->drv_priv; |
1334 | struct ieee80211_key_conf ps_key = { }; | 1334 | struct ieee80211_key_conf ps_key = { }; |
1335 | int key; | ||
1335 | 1336 | ||
1336 | ath_node_attach(sc, sta, vif); | 1337 | ath_node_attach(sc, sta, vif); |
1337 | 1338 | ||
@@ -1339,7 +1340,9 @@ static int ath9k_sta_add(struct ieee80211_hw *hw, | |||
1339 | vif->type != NL80211_IFTYPE_AP_VLAN) | 1340 | vif->type != NL80211_IFTYPE_AP_VLAN) |
1340 | return 0; | 1341 | return 0; |
1341 | 1342 | ||
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; | ||
1343 | 1346 | ||
1344 | return 0; | 1347 | return 0; |
1345 | } | 1348 | } |
@@ -1356,6 +1359,7 @@ static void ath9k_del_ps_key(struct ath_softc *sc, | |||
1356 | return; | 1359 | return; |
1357 | 1360 | ||
1358 | ath_key_delete(common, &ps_key); | 1361 | ath_key_delete(common, &ps_key); |
1362 | an->ps_key = 0; | ||
1359 | } | 1363 | } |
1360 | 1364 | ||
1361 | static int ath9k_sta_remove(struct ieee80211_hw *hw, | 1365 | static int ath9k_sta_remove(struct ieee80211_hw *hw, |