aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.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/iwl-3945.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/iwl-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 0eb0faa9d3cf..5ffbce8f4563 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -946,8 +946,7 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
946 tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]); 946 tx_cmd->supp_rates[1], tx_cmd->supp_rates[0]);
947} 947}
948 948
949static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, 949static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate)
950 u16 tx_rate, u8 flags)
951{ 950{
952 unsigned long flags_spin; 951 unsigned long flags_spin;
953 struct iwl_station_entry *station; 952 struct iwl_station_entry *station;
@@ -961,10 +960,9 @@ static u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
961 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK; 960 station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK;
962 station->sta.rate_n_flags = cpu_to_le16(tx_rate); 961 station->sta.rate_n_flags = cpu_to_le16(tx_rate);
963 station->sta.mode = STA_CONTROL_MODIFY_MSK; 962 station->sta.mode = STA_CONTROL_MODIFY_MSK;
964 963 iwl_send_add_sta(priv, &station->sta, CMD_ASYNC);
965 spin_unlock_irqrestore(&priv->sta_lock, flags_spin); 964 spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
966 965
967 iwl_send_add_sta(priv, &station->sta, flags);
968 IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n", 966 IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n",
969 sta_id, tx_rate); 967 sta_id, tx_rate);
970 return sta_id; 968 return sta_id;
@@ -2472,8 +2470,7 @@ static int iwl3945_manage_ibss_station(struct iwl_priv *priv,
2472 2470
2473 iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id, 2471 iwl3945_sync_sta(priv, vif_priv->ibss_bssid_sta_id,
2474 (priv->band == IEEE80211_BAND_5GHZ) ? 2472 (priv->band == IEEE80211_BAND_5GHZ) ?
2475 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP, 2473 IWL_RATE_6M_PLCP : IWL_RATE_1M_PLCP);
2476 CMD_ASYNC);
2477 iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id); 2474 iwl3945_rate_scale_init(priv->hw, vif_priv->ibss_bssid_sta_id);
2478 2475
2479 return 0; 2476 return 0;