diff options
| author | Nitesh Shah <niteshs@codeaurora.org> | 2017-02-22 20:36:59 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-03-01 00:38:08 -0800 |
| commit | 869651fd3b62474e7ae09f18e667e1ce2d15f54a (patch) | |
| tree | b1f7c3fc7ce7a6bc4349c0907c4b0b84d3ee0ae8 | |
| parent | 988cdb16511c93083f8d3f17ec4384a565fcae9d (diff) | |
qcacld-3.0: Avoid race condition to get pcl while stopping P2P GO
In the case of concurrency, considering STA+P2P-GO, if P2P-GO is
removed, then cds_decr_session_set_pcl() will be called from two
contexts mc_thread and supplicant. Thus, if race occurs, then
cds_store_and_del_conn_info() will remove STA temporarily for one
caller, and it simply returns for second caller. As
cds_conc_connection_info stores garbage values for the second
caller, thus, new interface is created with junk variable.
The change is to avoid the race condition for calling
cds_decr_session_set_pcl() in two contexts. The change is also
to initialize cds_conc_connection_info() with zero before simply
returning because of failure in cds_store_and_del_conn_info() to
avoid creating new interface with junk values.
Change-Id: I7bc4dcea6dfb66954f2cead607eef303df62e6d6
CRs-Fixed: 2009364
| -rw-r--r-- | core/cds/src/cds_concurrency.c | 1 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_hostapd.c | 14 |
2 files changed, 9 insertions, 6 deletions
diff --git a/core/cds/src/cds_concurrency.c b/core/cds/src/cds_concurrency.c index c9cfab952af4..ec1f1854a3b8 100644 --- a/core/cds/src/cds_concurrency.c +++ b/core/cds/src/cds_concurrency.c @@ -2221,6 +2221,7 @@ static void cds_store_and_del_conn_info(enum cds_con_mode mode, bool found = false; cds_context_type *cds_ctx; + qdf_mem_zero(info, sizeof(*info)); cds_ctx = cds_get_context(QDF_MODULE_ID_QDF); if (!cds_ctx) { cds_err("Invalid CDS Context"); diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 0d9643adec1c..6ac218253bf3 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -2123,12 +2123,6 @@ stopbss: qdf_status); } - /* once the event is set, structure dev/pHostapdAdapter should - * not be touched since they are now subject to being deleted - * by another thread */ - if (eSAP_STOP_BSS_EVENT == sapEvent) - qdf_event_set(&pHostapdState->qdf_stop_bss_event); - /* notify userspace that the BSS has stopped */ memset(&we_custom_event, '\0', sizeof(we_custom_event)); memcpy(&we_custom_event, stopBssEvent, event_len); @@ -2140,6 +2134,14 @@ stopbss: (char *)we_custom_event_generic); cds_decr_session_set_pcl(pHostapdAdapter->device_mode, pHostapdAdapter->sessionId); + + /* once the event is set, structure dev/pHostapdAdapter should + * not be touched since they are now subject to being deleted + * by another thread + */ + if (eSAP_STOP_BSS_EVENT == sapEvent) + qdf_event_set(&pHostapdState->qdf_stop_bss_event); + cds_dump_concurrency_info(); /* Send SCC/MCC Switching event to IPA */ hdd_ipa_send_mcc_scc_msg(pHddCtx, pHddCtx->mcc_mode); |
