From 3554e4e25fe6473a37ede945e5c08778c01ef8a5 Mon Sep 17 00:00:00 2001 From: Vidyullatha Kanchanapally Date: Wed, 12 Aug 2015 12:43:18 -0700 Subject: [PATCH] qcacld-3.0: Error handling in Roaming code #2 Qcacld-2.0 to qcacld-3.0 propagation. This fix contains the following changes 1. Ensure rx mgmt packet is freed in all cases. 2. Fail preauth if the pre-auth response timer failed to start. 3. Correct some logging and remove unnecessary code. Change-Id: Icd3a12ba8878de5bad7ff1125ba8be123dfae4eb CRs-Fixed: 808756 --- core/mac/src/pe/lim/lim_ft.c | 35 +++++++--------- .../src/pe/lim/lim_process_message_queue.c | 40 ++++++++----------- .../src/pe/lim/lim_process_mlm_req_messages.c | 10 ----- .../src/pe/lim/lim_process_sme_req_messages.c | 13 +++--- 4 files changed, 37 insertions(+), 61 deletions(-) diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index c96327c12d67..92769e8bb12d 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -370,35 +370,28 @@ void lim_perform_ft_pre_auth(tpAniSirGlobal pMac, CDF_STATUS status, psessionEntry->ftPEContext.pFTPreAuthReq) { /* Only 11r assoc has FT IEs */ if (psessionEntry->ftPEContext.pFTPreAuthReq->ft_ies == NULL) { - PELOGE(lim_log(pMac, LOGE, - "%s: FTIEs for Auth Req Seq 1 is absent", - __func__); - ) + lim_log(pMac, LOGE, + FL("FTIEs for Auth Req Seq 1 is absent")); goto preauth_fail; } } if (status != CDF_STATUS_SUCCESS) { - PELOGE(lim_log(pMac, LOGE, - "%s: Change channel not successful for FT pre-auth", - __func__); - ) + lim_log(pMac, LOGE, + FL(" Change channel not successful for FT pre-auth")); goto preauth_fail; } /* Nothing to be done if the session is not in STA mode */ if (!LIM_IS_STA_ROLE(psessionEntry)) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOGE(lim_log - (pMac, LOGE, FL("psessionEntry is not in STA mode")); - ) + lim_log(pMac, LOGE, FL("psessionEntry is not in STA mode")); #endif return; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOG2(lim_log(pMac, LOG2, "Entered wait auth2 state for FT" - " (old session %p)", psessionEntry); - ) + lim_log(pMac, LOG2, "Entered wait auth2 state for FT (old session %p)", + psessionEntry); #endif if (psessionEntry->is11Rconnection) { /* Now we are on the right channel and need to send out Auth1 and @@ -423,15 +416,15 @@ void lim_perform_ft_pre_auth(tpAniSirGlobal pMac, CDF_STATUS status, if (TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer)) { #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOGE(lim_log(pMac, LOGE, FL("FT Auth Rsp Timer Start Failed"));) + lim_log(pMac, LOGE, FL("FT Auth Rsp Timer Start Failed")); #endif + goto preauth_fail; } - MTRACE(mac_trace - (pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, - eLIM_FT_PREAUTH_RSP_TIMER)); + MTRACE(mac_trace(pMac, TRACE_CODE_TIMER_ACTIVATE, + psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER)); #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG - PELOG1(lim_log(pMac, LOG1, FL("FT Auth Rsp Timer Started"));) + lim_log(pMac, LOG1, FL("FT Auth Rsp Timer Started")); #endif #ifdef FEATURE_WLAN_DIAG_SUPPORT lim_diag_event_report(pMac, WLAN_PE_DIAG_ROAM_AUTH_START_EVENT, @@ -439,8 +432,8 @@ void lim_perform_ft_pre_auth(tpAniSirGlobal pMac, CDF_STATUS status, #endif lim_send_auth_mgmt_frame(pMac, &authFrame, - psessionEntry->ftPEContext.pFTPreAuthReq-> - preAuthbssId, LIM_NO_WEP_IN_FC, psessionEntry); + psessionEntry->ftPEContext.pFTPreAuthReq->preAuthbssId, + LIM_NO_WEP_IN_FC, psessionEntry); return; diff --git a/core/mac/src/pe/lim/lim_process_message_queue.c b/core/mac/src/pe/lim/lim_process_message_queue.c index ac63aee78c87..928e5d7d5329 100644 --- a/core/mac/src/pe/lim/lim_process_message_queue.c +++ b/core/mac/src/pe/lim/lim_process_message_queue.c @@ -804,8 +804,7 @@ lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg if (fc.subType == SIR_MAC_MGMT_AUTH) { #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG lim_log(pMac, LOG1, - FL - ("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"), + FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"), fc.protVer, fc.type, fc.subType, WMA_GET_RX_MAC_RATE_IDX(pRxPacketInfo)); lim_print_mac_addr(pMac, pHdr->bssId, LOG1); @@ -813,31 +812,28 @@ lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg if (lim_process_auth_frame_no_session (pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS) { - lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, - pRxPacketInfo, limMsg->bodyptr); - return; + goto end; } } #endif + /* Public action frame can be received from non-assoc stations*/ if ((fc.subType != SIR_MAC_MGMT_PROBE_RSP) && (fc.subType != SIR_MAC_MGMT_BEACON) && (fc.subType != SIR_MAC_MGMT_PROBE_REQ) - && (fc.subType != SIR_MAC_MGMT_ACTION) /* Public action frame can be received from non-associated stations. */ - ) { + && (fc.subType != SIR_MAC_MGMT_ACTION)) { - if ((psessionEntry = - pe_find_session_by_peer_sta(pMac, pHdr->sa, - &sessionId)) == NULL) { - lim_log(pMac, LOG1, - FL - ("session does not exist for given bssId")); - lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, - pRxPacketInfo, limMsg->bodyptr); - return; - } else - lim_log(pMac, LOG1, - "SessionId:%d Session Exist for given Bssid", + psessionEntry = pe_find_session_by_peer_sta(pMac, + pHdr->sa, &sessionId); + if (psessionEntry == NULL) { + lim_log(pMac, LOG3, + FL("session does not exist for bssId")); + lim_print_mac_addr(pMac, pHdr->sa, LOG3); + goto end; + } else { + lim_log(pMac, LOG3, + "SessionId:%d exists for given Bssid", psessionEntry->peSessionId); + } } /* For p2p resp frames search for valid session with DA as */ /* BSSID will be SA and session will be present with DA only */ @@ -850,9 +846,7 @@ lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg /* Check if frame is registered by HDD */ if (lim_check_mgmt_registered_frames(pMac, pRxPacketInfo, psessionEntry)) { lim_log(pMac, LOG1, FL("Received frame is passed to SME")); - lim_pkt_free(pMac, TXRX_FRM_802_11_MGMT, pRxPacketInfo, - limMsg->bodyptr); - return; + goto end; } if (fc.protVer != SIR_MAC_PROTOCOL_VERSION) { /* Received Frame with non-zero Protocol Version */ @@ -864,7 +858,7 @@ lim_handle80211_frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, uint8_t *pDeferMsg #ifdef WLAN_DEBUG pMac->lim.numProtErr++; #endif - return; + goto end; } /* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */ diff --git a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c index 8693bd801f20..c1761c855218 100644 --- a/core/mac/src/pe/lim/lim_process_mlm_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_mlm_req_messages.c @@ -1874,7 +1874,6 @@ static void lim_process_mlm_disassoc_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) { tLimMlmDisassocReq *mlm_disassoc_req; - tpPESession session; if (msg_buf == NULL) { lim_log(mac_ctx, LOGE, @@ -1888,15 +1887,6 @@ lim_process_mlm_disassoc_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf) mlm_disassoc_req->sessionId, MAC_ADDR_ARRAY(mlm_disassoc_req->peerMacAddr)); - session = pe_find_session_by_session_id(mac_ctx, - mlm_disassoc_req->sessionId); - if (NULL == session) { - lim_log(mac_ctx, LOGE, - FL("session does not exist for given sessionId %d"), - mlm_disassoc_req->sessionId); - return; - } - lim_process_mlm_disassoc_req_ntf(mac_ctx, CDF_STATUS_SUCCESS, (uint32_t *) msg_buf); } diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index ee010b6a4170..934531e06572 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -2476,6 +2476,9 @@ static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBu switch (psessionEntry->limSmeState) { case eLIM_SME_ASSOCIATED_STATE: case eLIM_SME_LINK_EST_STATE: + lim_log(pMac, LOG1, + FL("Rcvd SME_DISASSOC_REQ in limSmeState: %d "), + psessionEntry->limSmeState); psessionEntry->limPrevSmeState = psessionEntry->limSmeState; psessionEntry->limSmeState = eLIM_SME_WT_DISASSOC_STATE; @@ -2483,13 +2486,9 @@ static void __lim_process_sme_disassoc_req(tpAniSirGlobal pMac, uint32_t *pMsgBu /* Delete all TDLS peers connected before leaving BSS */ lim_delete_tdls_peers(pMac, psessionEntry); #endif - MTRACE(mac_trace - (pMac, TRACE_CODE_SME_STATE, - psessionEntry->peSessionId, - psessionEntry->limSmeState)); - lim_log(pMac, LOG1, - FL("Rcvd SME_DISASSOC_REQ while in limSmeState: %d "), - psessionEntry->limSmeState); + MTRACE(mac_trace(pMac, TRACE_CODE_SME_STATE, + psessionEntry->peSessionId, + psessionEntry->limSmeState)); break; case eLIM_SME_WT_DEAUTH_STATE: