aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2010-05-05 05:26:06 -0400
committerReinette Chatre <reinette.chatre@intel.com>2010-05-13 13:44:16 -0400
commit9c5ac091b269912cd30fade987f4bc615ef3be90 (patch)
tree698fe77ad1f144ca1c2e3ba9738946a22253399f /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent94adfaa406420ae035b1b760e3d5015775fe7b7c (diff)
iwlwifi: fix and add missing sta_lock usage
There are a few places where sta_lock is used, but the station information protected by it is accessed outside of the lock. Address this in two ways, if the access won't sleep then just move the access into the lock, if the access can sleep then copy the needed station information to the stack to be accessed without risk of it changing while access in progress. Additionally, a number of other places access station station information without holding the sta_lock, fix those as well. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 445406406bd0..82beeb5a2af9 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -196,6 +196,7 @@ static int iwl3945_set_wep_dynamic_key_info(struct iwl_priv *priv,
196static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id) 196static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id)
197{ 197{
198 unsigned long flags; 198 unsigned long flags;
199 struct iwl_addsta_cmd sta_cmd;
199 200
200 spin_lock_irqsave(&priv->sta_lock, flags); 201 spin_lock_irqsave(&priv->sta_lock, flags);
201 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key)); 202 memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl_hw_key));
@@ -204,11 +205,11 @@ static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id)
204 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC; 205 priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
205 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK; 206 priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
206 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK; 207 priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
208 memcpy(&sta_cmd, &priv->stations[sta_id].sta, sizeof(struct iwl_addsta_cmd));
207 spin_unlock_irqrestore(&priv->sta_lock, flags); 209 spin_unlock_irqrestore(&priv->sta_lock, flags);
208 210
209 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n"); 211 IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n");
210 iwl_send_add_sta(priv, &priv->stations[sta_id].sta, 0); 212 return iwl_send_add_sta(priv, &sta_cmd, CMD_SYNC);
211 return 0;
212} 213}
213 214
214static int iwl3945_set_dynamic_key(struct iwl_priv *priv, 215static int iwl3945_set_dynamic_key(struct iwl_priv *priv,