Commit 15677a7d authored by Michal Kazior's avatar Michal Kazior Committed by Kalle Valo

ath10k: fix static wep with more than 1 key in client mode

The default keyidx callback may be called after
more than 1 key is installed. This led to only 1
WEP key being reinstalled only. This caused Rxed
traffic encrypted with other WEP keys to be
dropped in client mode.
Tested-by: default avatarBartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: default avatarMichal Kazior <michal.kazior@tieto.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 7c8cc7eb
...@@ -360,39 +360,42 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif, ...@@ -360,39 +360,42 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif,
return first_errno; return first_errno;
} }
static int ath10k_mac_vif_sta_fix_wep_key(struct ath10k_vif *arvif) static int ath10k_mac_vif_sta_fix_wep_key(struct ath10k_vif *arvif, int keyidx)
{ {
struct ath10k *ar = arvif->ar; struct ath10k *ar = arvif->ar;
enum nl80211_iftype iftype = arvif->vif->type; enum nl80211_iftype iftype = arvif->vif->type;
struct ieee80211_key_conf *key; struct ieee80211_key_conf *key;
u32 flags = 0; u32 flags;
int num = 0;
int i;
int ret; int ret;
int i;
lockdep_assert_held(&ar->conf_mutex); lockdep_assert_held(&ar->conf_mutex);
if (iftype != NL80211_IFTYPE_STATION) if (iftype != NL80211_IFTYPE_STATION)
return 0; return 0;
if (keyidx < 0)
return 0;
for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) { for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) {
if (arvif->wep_keys[i]) { if (!arvif->wep_keys[i])
key = arvif->wep_keys[i]; continue;
++num;
}
}
if (num != 1) key = arvif->wep_keys[i];
return 0;
flags |= WMI_KEY_PAIRWISE; flags = 0;
flags |= WMI_KEY_TX_USAGE; flags |= WMI_KEY_PAIRWISE;
ret = ath10k_install_key(arvif, key, SET_KEY, arvif->bssid, flags); if (key->keyidx == keyidx)
if (ret) { flags |= WMI_KEY_TX_USAGE;
ath10k_warn(ar, "failed to install key %i on vdev %i: %d\n",
key->keyidx, arvif->vdev_id, ret); ret = ath10k_install_key(arvif, key, SET_KEY, arvif->bssid,
return ret; flags);
if (ret) {
ath10k_warn(ar, "failed to install key %i on vdev %i: %d\n",
key->keyidx, arvif->vdev_id, ret);
return ret;
}
} }
return 0; return 0;
...@@ -4846,7 +4849,7 @@ static void ath10k_set_default_unicast_key(struct ieee80211_hw *hw, ...@@ -4846,7 +4849,7 @@ static void ath10k_set_default_unicast_key(struct ieee80211_hw *hw,
arvif->def_wep_key_idx = keyidx; arvif->def_wep_key_idx = keyidx;
ret = ath10k_mac_vif_sta_fix_wep_key(arvif); ret = ath10k_mac_vif_sta_fix_wep_key(arvif, keyidx);
if (ret) { if (ret) {
ath10k_warn(ar, "failed to fix sta wep key on vdev %i: %d\n", ath10k_warn(ar, "failed to fix sta wep key on vdev %i: %d\n",
arvif->vdev_id, ret); arvif->vdev_id, ret);
......
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