[3.8.y.z,extended,stable] Patch "ath9k: fix key allocation error handling for powersave keys" has been added to staging queue

Message ID 1369259722-24436-1-git-send-email-kamal@canonical.com
State New
Headers show

Commit Message

Kamal Mostafa May 22, 2013, 9:55 p.m.
This is a note to let you know that I have just added a patch titled

    ath9k: fix key allocation error handling for powersave keys

to the linux-3.8.y-queue branch of the 3.8.y.z extended stable tree 
which can be found at:


If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.8.y.z tree, see



From 73b630df0f07d2829c9e066f8bc4b31676ccfe0d Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@openwrt.org>
Date: Sat, 27 Apr 2013 11:47:01 +0200
Subject: ath9k: fix key allocation error handling for powersave keys

commit 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 upstream.

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.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
 drivers/net/wireless/ath/ath9k/main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)



diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index dd91f8f..a929adc 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -1236,6 +1236,7 @@  static int ath9k_sta_add(struct ieee80211_hw *hw,
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	struct ath_node *an = (struct ath_node *) sta->drv_priv;
 	struct ieee80211_key_conf ps_key = { };
+	int key;

 	ath_node_attach(sc, sta, vif);

@@ -1243,7 +1244,9 @@  static int ath9k_sta_add(struct ieee80211_hw *hw,
 	    vif->type != NL80211_IFTYPE_AP_VLAN)
 		return 0;

-	an->ps_key = ath_key_config(common, vif, sta, &ps_key);
+	key = ath_key_config(common, vif, sta, &ps_key);
+	if (key > 0)
+		an->ps_key = key;

 	return 0;
@@ -1260,6 +1263,7 @@  static void ath9k_del_ps_key(struct ath_softc *sc,

 	ath_key_delete(common, &ps_key);
+	an->ps_key = 0;

 static int ath9k_sta_remove(struct ieee80211_hw *hw,