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
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 ac63aee..928e5d7 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 @@
 		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 @@
 			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 @@
 	/* 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 @@
 #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 */