Commit ae167131 authored by Sujith Manoharan's avatar Sujith Manoharan Committed by Kalle Valo

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: default avatarSujith Manoharan <c_manoha@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 504f6cdf
...@@ -219,6 +219,8 @@ struct ath10k_peer { ...@@ -219,6 +219,8 @@ struct ath10k_peer {
int vdev_id; int vdev_id;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS); DECLARE_BITMAP(peer_ids, ATH10K_MAX_NUM_PEER_IDS);
/* protected by ar->data_lock */
struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1]; struct ieee80211_key_conf *keys[WMI_MAX_KEY_INDEX + 1];
}; };
......
...@@ -136,7 +136,9 @@ static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif, ...@@ -136,7 +136,9 @@ static int ath10k_install_peer_wep_keys(struct ath10k_vif *arvif,
if (ret) if (ret)
return ret; return ret;
spin_lock_bh(&ar->data_lock);
peer->keys[i] = arvif->wep_keys[i]; peer->keys[i] = arvif->wep_keys[i];
spin_unlock_bh(&ar->data_lock);
} }
return 0; return 0;
...@@ -173,7 +175,9 @@ static int ath10k_clear_peer_keys(struct ath10k_vif *arvif, ...@@ -173,7 +175,9 @@ static int ath10k_clear_peer_keys(struct ath10k_vif *arvif,
ath10k_warn(ar, "failed to remove peer wep key %d: %d\n", ath10k_warn(ar, "failed to remove peer wep key %d: %d\n",
i, ret); i, ret);
spin_lock_bh(&ar->data_lock);
peer->keys[i] = NULL; peer->keys[i] = NULL;
spin_unlock_bh(&ar->data_lock);
} }
return first_errno; return first_errno;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment