]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.9.3/ath9k-fix-key-allocation-error-handling-for-powersave-keys.patch
Linux 4.14.107
[thirdparty/kernel/stable-queue.git] / releases / 3.9.3 / ath9k-fix-key-allocation-error-handling-for-powersave-keys.patch
1 From 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@openwrt.org>
3 Date: Sat, 27 Apr 2013 11:47:01 +0200
4 Subject: ath9k: fix key allocation error handling for powersave keys
5
6 From: Felix Fietkau <nbd@openwrt.org>
7
8 commit 4ef69d0394cba8caa9f75d3f2e53429bfb8b3045 upstream.
9
10 If no keycache slots are available, ath_key_config can return -ENOSPC.
11 If the key index is not checked for errors, it can lead to logspam that
12 looks like this: "ath: wiphy0: keyreset: keycache entry 228 out of range"
13 This can cause follow-up errors if the invalid keycache index gets
14 used for tx.
15
16 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
17 Signed-off-by: John W. Linville <linville@tuxdriver.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 drivers/net/wireless/ath/ath9k/main.c | 6 +++++-
22 1 file changed, 5 insertions(+), 1 deletion(-)
23
24 --- a/drivers/net/wireless/ath/ath9k/main.c
25 +++ b/drivers/net/wireless/ath/ath9k/main.c
26 @@ -1308,6 +1308,7 @@ static int ath9k_sta_add(struct ieee8021
27 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
28 struct ath_node *an = (struct ath_node *) sta->drv_priv;
29 struct ieee80211_key_conf ps_key = { };
30 + int key;
31
32 ath_node_attach(sc, sta, vif);
33
34 @@ -1315,7 +1316,9 @@ static int ath9k_sta_add(struct ieee8021
35 vif->type != NL80211_IFTYPE_AP_VLAN)
36 return 0;
37
38 - an->ps_key = ath_key_config(common, vif, sta, &ps_key);
39 + key = ath_key_config(common, vif, sta, &ps_key);
40 + if (key > 0)
41 + an->ps_key = key;
42
43 return 0;
44 }
45 @@ -1332,6 +1335,7 @@ static void ath9k_del_ps_key(struct ath_
46 return;
47
48 ath_key_delete(common, &ps_key);
49 + an->ps_key = 0;
50 }
51
52 static int ath9k_sta_remove(struct ieee80211_hw *hw,