diff options
author | Sujith Manoharan <c_manoha@qca.qualcomm.com> | 2014-11-25 01:16:59 -0500 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2014-11-26 01:37:26 -0500 |
commit | ae1671318e602860970c7020f3b23f2349dda757 (patch) | |
tree | 18f09160fb4ef2dbdd8b0318458c74ee0efc33bc | |
parent | 504f6cdf4ac3dfcf645453b5cd65dcc9aed0e1b9 (diff) |
ath10k: fix locking for WEP keys
peer->keys needs to be protected by data_lock
since it is also accessed from the WMI path.
Both install() and clear() routines for peer
keys modify the key contents, so use the data_lock
to avoid races.
Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
-rw-r--r-- | drivers/net/wireless/ath/ath10k/core.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath10k/mac.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index c5107854a8f6..90775a5358b8 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h | |||
@@ -219,6 +219,8 @@ struct ath10k_peer { | |||
219 | int vdev_id; | 219 | int vdev_id; |
220 | u8 addr[ETH_ALEN]; | 220 | u8 addr[ETH_ALEN]; |
221 | DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS); | 221 | DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS); |
222 | |||
223 | /* protected by ar->data_lock */ | ||
222 | struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; | 224 | struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; |
223 | }; | 225 | }; |
224 | 226 | ||
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index c6c09c1d421e..d5aaaa0b9e15 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c | |||
@@ -136,7 +136,9 @@ static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif, | |||
136 | if (ret) | 136 | if (ret) |
137 | return ret; | 137 | return ret; |
138 | 138 | ||
139 | spin_lock_bh(&ar->data_lock); | ||
139 | peer->keys[i] = arvif->wep_keys[i]; | 140 | peer->keys[i] = arvif->wep_keys[i]; |
141 | spin_unlock_bh(&ar->data_lock); | ||
140 | } | 142 | } |
141 | 143 | ||
142 | return 0; | 144 | return 0; |
@@ -173,7 +175,9 @@ static int ath10k_clear_peer_keys(struct ath10k_vif *arvif, | |||
173 | ath10k_warn(ar, "failed to remove peer wep key %d: %d\n", | 175 | ath10k_warn(ar, "failed to remove peer wep key %d: %d\n", |
174 | i, ret); | 176 | i, ret); |
175 | 177 | ||
178 | spin_lock_bh(&ar->data_lock); | ||
176 | peer->keys[i] = NULL; | 179 | peer->keys[i] = NULL; |
180 | spin_unlock_bh(&ar->data_lock); | ||
177 | } | 181 | } |
178 | 182 | ||
179 | return first_errno; | 183 | return first_errno; |