From 2f3ce00c77a575c8dd68264171920b7f4d7d1c7b Mon Sep 17 00:00:00 2001 From: Yun Park Date: Wed, 30 Nov 2016 10:09:21 -0800 Subject: qcacld-3.0: Check the validity of CDS context before disable WDI path While WLAN module closed, there is a race condition and CDS scheduler could not be closed before CDS context closure. This could cause a crash by acessing NULL cds context while the last WLAN_CLIENT_DISCONNECT event processing. Fix to check the CDS context before processing the last disconenct event. Change-Id: I9aba4659ec6ea682697f342d9c92e09d8f2f90e8 CRs-Fixed: 1096347 --- core/hdd/src/wlan_hdd_ipa.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 1a1f97d4dc6b..a539e3cac038 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -1298,6 +1298,12 @@ static void hdd_ipa_uc_handle_last_discon(struct hdd_ipa_priv *hdd_ipa) { p_cds_contextType cds_ctx = hdd_ipa->hdd_ctx->pcds_context; + if (!cds_ctx || !cds_ctx->pdev_txrx_ctx) { + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "txrx context is NULL"); + QDF_ASSERT(0); + return; + } + hdd_ipa->resource_unloading = true; HDD_IPA_LOG(QDF_TRACE_LEVEL_INFO, "%s: Disable FW RX PIPE", __func__); ol_txrx_ipa_uc_set_active(cds_ctx->pdev_txrx_ctx, false, false); @@ -4150,9 +4156,11 @@ static int __hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id, if (hdd_ipa_uc_is_enabled(hdd_ipa->hdd_ctx)) { if (hdd_ipa->resource_loading) { unsigned int pending_event_count; - struct ipa_uc_pending_event *pending_event = NULL; + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, "IPA resource %s inprogress", + hdd_ipa->resource_loading ? "load":"unload"); + hdd_err("IPA resource %s inprogress", hdd_ipa->resource_loading ? "load":"unload"); @@ -4170,7 +4178,8 @@ static int __hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id, } if (!pending_event) { - hdd_err("Pending event memory alloc fail"); + HDD_IPA_LOG(QDF_TRACE_LEVEL_ERROR, + "Pending event memory alloc fail"); qdf_mutex_release(&hdd_ipa->event_lock); return -ENOMEM; } -- cgit v1.2.3