Skip to content

Commit 336097d

Browse files
Aditya Kumar SinghJeff Johnson
authored andcommitted
wifi: ath12k: fix key cache handling
Currently, an interface is created in the driver during channel assignment. If mac80211 attempts to set a key for an interface before this assignment, the driver caches the key. Once the interface is created, the driver installs the cached key to the hardware. This sequence is exemplified in mesh mode operation where the group key is set before channel assignment. However, in ath12k_mac_update_key_cache(), after caching the key, due to incorrect logic, it is deleted from the cache during the subsequent loop iteration. As a result, after the interface is created, the driver does not find any cached key, and the key is not installed to the hardware which is wrong. This leads to issue in mesh, where broadcast traffic is not encrypted over the air. Fix this issue by adjusting the logic of ath12k_mac_update_key_cache() properly. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3-03253.1-QCAHKSWPL_SILICONZ-29 # Nicolas Escande <[email protected]> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 # Nicolas Escande <[email protected]> Fixes: 25e18b9 ("wifi: ath12k: modify ath12k_mac_op_set_key() for MLO") Signed-off-by: Aditya Kumar Singh <[email protected]> Acked-by: Kalle Valo <[email protected]> Tested-by: Nicolas Escande <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent 4aae869 commit 336097d

File tree

1 file changed

+18
-12
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+18
-12
lines changed

drivers/net/wireless/ath/ath12k/mac.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4657,7 +4657,23 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,
46574657
struct ieee80211_sta *sta,
46584658
struct ieee80211_key_conf *key)
46594659
{
4660-
struct ath12k_key_conf *key_conf = NULL, *tmp;
4660+
struct ath12k_key_conf *key_conf, *tmp;
4661+
4662+
list_for_each_entry_safe(key_conf, tmp, &cache->key_conf.list, list) {
4663+
if (key_conf->key != key)
4664+
continue;
4665+
4666+
/* If SET key entry is already present in cache, nothing to do,
4667+
* just return
4668+
*/
4669+
if (cmd == SET_KEY)
4670+
return 0;
4671+
4672+
/* DEL key for an old SET key which driver hasn't flushed yet.
4673+
*/
4674+
list_del(&key_conf->list);
4675+
kfree(key_conf);
4676+
}
46614677

46624678
if (cmd == SET_KEY) {
46634679
key_conf = kzalloc(sizeof(*key_conf), GFP_KERNEL);
@@ -4671,17 +4687,7 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,
46714687
list_add_tail(&key_conf->list,
46724688
&cache->key_conf.list);
46734689
}
4674-
if (list_empty(&cache->key_conf.list))
4675-
return 0;
4676-
list_for_each_entry_safe(key_conf, tmp, &cache->key_conf.list, list) {
4677-
if (key_conf->key == key) {
4678-
/* DEL key for an old SET key which driver hasn't flushed yet.
4679-
*/
4680-
list_del(&key_conf->list);
4681-
kfree(key_conf);
4682-
break;
4683-
}
4684-
}
4690+
46854691
return 0;
46864692
}
46874693

0 commit comments

Comments
 (0)