diff options
author | Michal Kazior <michal.kazior@tieto.com> | 2015-04-01 22:53:20 +0300 |
---|---|---|
committer | Kalle Valo <kvalo@qca.qualcomm.com> | 2015-04-09 15:00:11 +0300 |
commit | 15677a7dbe22976a5cb787a7352ac86bbd196cf1 (patch) | |
tree | 2f2ebd0ee1442061c90da4fb9606b1c9fd236b59 /drivers/net/wireless/ath | |
parent | 7c8cc7eb4f08d8de2cc2a4b093bad1499b47eb45 (diff) | |
download | linux-15677a7dbe22976a5cb787a7352ac86bbd196cf1.tar.xz |
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: Bartosz Markowski <bartosz.markowski@tieto.com>
Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath')
-rw-r--r-- | drivers/net/wireless/ath/ath10k/mac.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index db5a2c39be0f..ab3301b17ab1 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -360,39 +360,42 @@ static int ath10k_clear_vdev_key(struct ath10k_vif *arvif, 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; enum nl80211_iftype iftype = arvif->vif->type; struct ieee80211_key_conf *key; - u32 flags = 0; - int num = 0; - int i; + u32 flags; int ret; + int i; lockdep_assert_held(&ar->conf_mutex); if (iftype != NL80211_IFTYPE_STATION) return 0; + if (keyidx < 0) + return 0; + for (i = 0; i < ARRAY_SIZE(arvif->wep_keys); i++) { - if (arvif->wep_keys[i]) { - key = arvif->wep_keys[i]; - ++num; - } - } + if (!arvif->wep_keys[i]) + continue; - if (num != 1) - return 0; + key = arvif->wep_keys[i]; - flags |= WMI_KEY_PAIRWISE; - flags |= WMI_KEY_TX_USAGE; + flags = 0; + flags |= WMI_KEY_PAIRWISE; - ret = ath10k_install_key(arvif, key, SET_KEY, arvif->bssid, flags); - if (ret) { - ath10k_warn(ar, "failed to install key %i on vdev %i: %d\n", - key->keyidx, arvif->vdev_id, ret); - return ret; + if (key->keyidx == keyidx) + flags |= WMI_KEY_TX_USAGE; + + ret = ath10k_install_key(arvif, key, SET_KEY, arvif->bssid, + 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; @@ -4846,7 +4849,7 @@ static void ath10k_set_default_unicast_key(struct ieee80211_hw *hw, 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) { ath10k_warn(ar, "failed to fix sta wep key on vdev %i: %d\n", arvif->vdev_id, ret); |