aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2012-01-06 16:16:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-01-24 14:08:35 -0500
commit2da424b0773cea3db47e1e81db71eeebde8269d4 (patch)
treedb9be596b509f53fb0f5f8f390e01f595f1a11b4 /drivers/net/wireless
parent017664fe8e11ec93dfe3faca5b7ff21071011e6a (diff)
iwlwifi: Sanity check for sta_id
On my testing, I saw some strange behavior [ 421.739708] iwlwifi 0000:01:00.0: ACTIVATE a non DRIVER active station id 148 addr 00:00:00:00:00:00 [ 421.739719] iwlwifi 0000:01:00.0: iwl_sta_ucode_activate Added STA id 148 addr 00:00:00:00:00:00 to uCode not sure how it happen, but adding the sanity check to prevent memory corruption Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-sta.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
index 7353826095f1..8d4353a42568 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-sta.c
@@ -35,9 +35,12 @@
35#include "iwl-trans.h" 35#include "iwl-trans.h"
36 36
37/* priv->shrd->sta_lock must be held */ 37/* priv->shrd->sta_lock must be held */
38static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id) 38static int iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
39{ 39{
40 40 if (sta_id >= IWLAGN_STATION_COUNT) {
41 IWL_ERR(priv, "invalid sta_id %u", sta_id);
42 return -EINVAL;
43 }
41 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) 44 if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE))
42 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u " 45 IWL_ERR(priv, "ACTIVATE a non DRIVER active station id %u "
43 "addr %pM\n", 46 "addr %pM\n",
@@ -53,6 +56,7 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
53 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n", 56 IWL_DEBUG_ASSOC(priv, "Added STA id %u addr %pM to uCode\n",
54 sta_id, priv->stations[sta_id].sta.sta.addr); 57 sta_id, priv->stations[sta_id].sta.sta.addr);
55 } 58 }
59 return 0;
56} 60}
57 61
58static int iwl_process_add_sta_resp(struct iwl_priv *priv, 62static int iwl_process_add_sta_resp(struct iwl_priv *priv,
@@ -77,8 +81,7 @@ static int iwl_process_add_sta_resp(struct iwl_priv *priv,
77 switch (pkt->u.add_sta.status) { 81 switch (pkt->u.add_sta.status) {
78 case ADD_STA_SUCCESS_MSK: 82 case ADD_STA_SUCCESS_MSK:
79 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n"); 83 IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n");
80 iwl_sta_ucode_activate(priv, sta_id); 84 ret = iwl_sta_ucode_activate(priv, sta_id);
81 ret = 0;
82 break; 85 break;
83 case ADD_STA_NO_ROOM_IN_TABLE: 86 case ADD_STA_NO_ROOM_IN_TABLE:
84 IWL_ERR(priv, "Adding station %d failed, no room in table.\n", 87 IWL_ERR(priv, "Adding station %d failed, no room in table.\n",