qcacld-3.0: Implement crypto locking mechanism

Implement a locking mechanism for retrieving and
storing crypto keys. Currently, due to race condition,
Host driver is fetching information in one thread while
simultaneously writing key information in another thread,
resulting in synchronization issues.

This change is to add lock mechanism while reading and writing
crypto keys.

Change-Id: I156b619cf7c3c052ad3122a6f808d732fb5e4f51
CRs-Fixed: 3672330
This commit is contained in:
Arun Kumar Khandavalli
2023-11-24 14:42:04 +05:30
committed by Ravindra Konda
parent e0f0a39e9b
commit 0348f36541

View File

@@ -1704,6 +1704,7 @@ cm_install_link_vdev_keys(struct wlan_objmgr_vdev *vdev)
return; return;
} }
wlan_crypto_aquire_lock();
for (i = 0; i < max_key_index; i++) { for (i = 0; i < max_key_index; i++) {
crypto_key = wlan_crypto_get_key(vdev, i); crypto_key = wlan_crypto_get_key(vdev, i);
if (!crypto_key) if (!crypto_key)
@@ -1716,6 +1717,7 @@ cm_install_link_vdev_keys(struct wlan_objmgr_vdev *vdev)
crypto_key->cipher_type); crypto_key->cipher_type);
key_present = true; key_present = true;
} }
wlan_crypto_release_lock();
if (!key_present && mlo_mgr_is_link_switch_in_progress(vdev)) { if (!key_present && mlo_mgr_is_link_switch_in_progress(vdev)) {
mlme_err("No key found for link_id %d", link_id); mlme_err("No key found for link_id %d", link_id);