From 1763abada008675585c3f4c79515bb65bb06b2b2 Mon Sep 17 00:00:00 2001 From: Nitesh Shah Date: Tue, 16 May 2017 12:55:48 +0530 Subject: [PATCH] qcacmn: Avoid race condition while modifying connection list In case of STA-AP case, new thread is created to call the func policy_mgr_check_sta_ap_concurrent_ch_intf() that calls policy_mgr_get_pcl_for_existing_conn() that modifies pm_conc_connection_list table. The mc_thread calls policy_mgr_get_valid_chan_weights() that also modifies pm_conc_connection_list table. But the race condition is created that mess up the pm_conc_connection_list table. This race condition also leads to the scenario where the STA connection to the AP is not updated properly . This shall lead to the improper PCL update for a STA+SAP concurrency and thus the channel switch fails. The fix is to protect the whole sequence of the function policy_mgr_check_sta_ap_concurrent_ch_intf() with mutex to avoid race condition. Change-Id: Ibb6d804afa70ef45d99e7ec9fc7fecc4993c7621 CRs-Fixed: 2047765 --- umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index a8d34b62bbd4..1695fc4bff80 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -668,9 +668,11 @@ void policy_mgr_check_sta_ap_concurrent_ch_intf(void *data) policy_mgr_err("SAP restart get channel callback in NULL"); return; } + qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock); status = pm_ctx->hdd_cbacks. wlan_hdd_get_channel_for_sap_restart(psoc, vdev_id, &channel, &sec_ch, restart_sap); + qdf_mutex_release(&pm_ctx->qdf_conc_list_lock); if (status != QDF_STATUS_SUCCESS) { policy_mgr_err("Failed to switch SAP channel"); return;