From 9913277e972c752675abbb4e54bf77aa3c0f7658 Mon Sep 17 00:00:00 2001 From: Will Huang Date: Thu, 3 May 2018 15:19:46 +0800 Subject: [PATCH] qcacld-3.0: Clear mac_ctx->sap.sapCtxList for SAP if SSR happen While SSR happen, hdd_reset_all_adapters will not clear mac_ctx->sap.sapCtxList[sapctx->sessionId].pSapContext, and later the sapctx will assign new sessionId after SSR restart SAP and update to mac_ctx->sap.sapCtxList. So sapctx/old sessionId still can be referenced by like wlan_sap_is_pre_cac_active and call pre cac cleanup on unexpected port. When SAP restart and set global sapCtxList in sap_set_session_param(), find matched sapctx and clear it before assigning updated value. Change-Id: Id02733cb22267ac0c1899d8caf9ac47c65e24a88 CRs-Fixed: 2232398 --- core/sap/src/sap_fsm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index d94b3a6894c6..d8b6d53d9bf0 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -1200,11 +1200,18 @@ QDF_STATUS sap_set_session_param(tHalHandle hal, struct sap_context *sapctx, uint32_t session_id) { tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + int i; sapctx->sessionId = session_id; sapctx->is_pre_cac_on = false; sapctx->pre_cac_complete = false; sapctx->chan_before_pre_cac = 0; + + /* When SSR, SAP will restart, clear the old context,sessionId */ + for (i = 0; i < SAP_MAX_NUM_SESSION; i++) { + if (mac_ctx->sap.sapCtxList[i].pSapContext == sapctx) + mac_ctx->sap.sapCtxList[i].pSapContext = NULL; + } mac_ctx->sap.sapCtxList[sapctx->sessionId].sessionID = sapctx->sessionId; mac_ctx->sap.sapCtxList[sapctx->sessionId].pSapContext = sapctx;