]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From 299f5462087f3bc2141e6bc83ba7e2b15d8a07d2 Mon Sep 17 00:00:00 2001 |
2 | From: Reinette Chatre <reinette.chatre@intel.com> | |
3 | Date: Thu, 30 Apr 2009 13:56:31 -0700 | |
4 | Subject: [PATCH] iwlwifi: update key flags at time key is set | |
5 | Patch-mainline: 2.6.30-rc6 | |
6 | References: bnc#487247 | |
7 | ||
8 | We need to be symmetrical in what is done when key is set and cleared. | |
9 | This is important wrt the key flags as they are used during key | |
10 | clearing and if they are not set when the key is set the key cannot be | |
11 | cleared completely. | |
12 | ||
13 | This addresses the many occurences of the WARN found in | |
14 | iwl_set_tkip_dynamic_key_info() and tracked in | |
15 | http://www.kerneloops.org/searchweek.php?search=iwl_set_dynamic_key | |
16 | ||
17 | If calling iwl_set_tkip_dynamic_key_info()/iwl_remove_dynamic_key() | |
18 | pair a few times in a row will cause that we run out of key space. | |
19 | This is because the index stored in the key flags is used by | |
20 | iwl_remove_dynamic_key() to decide if it should remove the key. | |
21 | Unfortunately the key flags, and hence the key index is currently only | |
22 | set at the time the key is written to the device (in | |
23 | iwl_update_tkip_key()) and _not_ in iwl_set_tkip_dynamic_key_info(). | |
24 | Fix this by setting flags in iwl_set_tkip_dynamic_key_info(). | |
25 | ||
26 | Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> | |
27 | Signed-off-by: John W. Linville <linville@tuxdriver.com> | |
28 | Acked-by: Jiri Benc <jbenc@suse.cz> | |
29 | ||
30 | --- | |
31 | drivers/net/wireless/iwlwifi/iwl-agn.c | 10 ---------- | |
32 | drivers/net/wireless/iwlwifi/iwl-sta.c | 11 +++++++++++ | |
33 | 2 files changed, 11 insertions(+), 10 deletions(-) | |
34 | ||
35 | --- linux-2.6.27-SLE11_BRANCH.orig/drivers/net/wireless/iwlwifi/iwl-agn.c | |
36 | +++ linux-2.6.27-SLE11_BRANCH/drivers/net/wireless/iwlwifi/iwl-agn.c | |
37 | @@ -3227,9 +3227,7 @@ static void iwl4965_mac_update_tkip_key( | |
38 | struct iwl_priv *priv = hw->priv; | |
39 | u8 sta_id = IWL_INVALID_STATION; | |
40 | unsigned long flags; | |
41 | - __le16 key_flags = 0; | |
42 | int i; | |
43 | - DECLARE_MAC_BUF(mac); | |
44 | ||
45 | IWL_DEBUG_MAC80211("enter\n"); | |
46 | ||
47 | @@ -3246,16 +3244,8 @@ static void iwl4965_mac_update_tkip_key( | |
48 | return; | |
49 | } | |
50 | ||
51 | - key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | |
52 | - key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | |
53 | - key_flags &= ~STA_KEY_FLG_INVALID; | |
54 | - | |
55 | - if (sta_id == priv->hw_params.bcast_sta_id) | |
56 | - key_flags |= STA_KEY_MULTICAST_MSK; | |
57 | - | |
58 | spin_lock_irqsave(&priv->sta_lock, flags); | |
59 | ||
60 | - priv->stations[sta_id].sta.key.key_flags = key_flags; | |
61 | priv->stations[sta_id].sta.key.tkip_rx_tsc_byte2 = (u8) iv32; | |
62 | ||
63 | for (i = 0; i < 5; i++) | |
64 | --- linux-2.6.27-SLE11_BRANCH.orig/drivers/net/wireless/iwlwifi/iwl-sta.c | |
65 | +++ linux-2.6.27-SLE11_BRANCH/drivers/net/wireless/iwlwifi/iwl-sta.c | |
66 | @@ -688,6 +688,14 @@ static int iwl_set_tkip_dynamic_key_info | |
67 | { | |
68 | unsigned long flags; | |
69 | int ret = 0; | |
70 | + __le16 key_flags = 0; | |
71 | + | |
72 | + key_flags |= (STA_KEY_FLG_TKIP | STA_KEY_FLG_MAP_KEY_MSK); | |
73 | + key_flags |= cpu_to_le16(keyconf->keyidx << STA_KEY_FLG_KEYID_POS); | |
74 | + key_flags &= ~STA_KEY_FLG_INVALID; | |
75 | + | |
76 | + if (sta_id == priv->hw_params.bcast_sta_id) | |
77 | + key_flags |= STA_KEY_MULTICAST_MSK; | |
78 | ||
79 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_IV; | |
80 | keyconf->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC; | |
81 | @@ -707,6 +715,9 @@ static int iwl_set_tkip_dynamic_key_info | |
82 | WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET, | |
83 | "no space for new kew"); | |
84 | ||
85 | + priv->stations[sta_id].sta.key.key_flags = key_flags; | |
86 | + | |
87 | + | |
88 | /* This copy is acutally not needed: we get the key with each TX */ | |
89 | memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16); | |
90 |