qcacld-3.0: mem alloc for variables instead of using stack

Currently, function variables in csr_send_join_req_msg and
csr_roam_connect uses stack and are consuming much of the stack
eventually reaching the stack end quickly.

To avoid stack consumption issue, mem alloc function variables
instead of using stack.

Change-Id: If6fecb7f7ca9a31fdda2ea12d40a110e6c238508
CRs-Fixed: 2045315
This commit is contained in:
Selvaraj, Sridhar
2017-05-12 15:32:45 +05:30
committed by snandini
parent aef3c7f03c
commit dc2ac8e2ef

View File

@@ -7887,7 +7887,7 @@ QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
uint32_t roamId = 0; uint32_t roamId = 0;
bool fCallCallback = false; bool fCallCallback = false;
tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
tSirBssDescription first_ap_profile; tSirBssDescription *first_ap_profile;
if (NULL == pSession) { if (NULL == pSession) {
sme_err("session does not exist for given sessionId: %d", sme_err("session does not exist for given sessionId: %d",
@@ -7899,6 +7899,13 @@ QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
sme_err("No profile specified"); sme_err("No profile specified");
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
first_ap_profile = qdf_mem_malloc(sizeof(*first_ap_profile));
if (NULL == first_ap_profile) {
sme_err("malloc fails for first_ap_profile");
return QDF_STATUS_E_NOMEM;
}
/* Initialize the count before proceeding with the Join requests */ /* Initialize the count before proceeding with the Join requests */
pSession->join_bssid_count = 0; pSession->join_bssid_count = 0;
sme_debug( sme_debug(
@@ -7989,9 +7996,9 @@ QDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
if ((pScanFilter->csrPersona == QDF_STA_MODE) || if ((pScanFilter->csrPersona == QDF_STA_MODE) ||
(pScanFilter->csrPersona == QDF_P2P_CLIENT_MODE)) { (pScanFilter->csrPersona == QDF_P2P_CLIENT_MODE)) {
csr_get_bssdescr_from_scan_handle(hBSSList, csr_get_bssdescr_from_scan_handle(hBSSList,
&first_ap_profile); first_ap_profile);
status = policy_mgr_handle_conc_multiport(pMac->psoc, status = policy_mgr_handle_conc_multiport(pMac->psoc,
sessionId, first_ap_profile.channelId); sessionId, first_ap_profile->channelId);
if ((QDF_IS_STATUS_SUCCESS(status)) && if ((QDF_IS_STATUS_SUCCESS(status)) &&
(!csr_wait_for_connection_update(pMac, true))) { (!csr_wait_for_connection_update(pMac, true))) {
sme_debug("conn update error"); sme_debug("conn update error");
@@ -8058,6 +8065,8 @@ end:
csr_roam_call_callback(pMac, sessionId, NULL, roamId, csr_roam_call_callback(pMac, sessionId, NULL, roamId,
eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE); eCSR_ROAM_FAILED, eCSR_ROAM_RESULT_FAILURE);
} }
qdf_mem_free(first_ap_profile);
return status; return status;
} }
@@ -13958,8 +13967,7 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
tSirMacRateSet ExRateSet; tSirMacRateSet ExRateSet;
tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId); tCsrRoamSession *pSession = CSR_GET_SESSION(pMac, sessionId);
uint32_t dwTmp, ucDot11Mode = 0; uint32_t dwTmp, ucDot11Mode = 0;
/* RSN MAX is bigger than WPA MAX */ uint8_t *wpaRsnIE = NULL;
uint8_t wpaRsnIE[DOT11F_IE_RSN_MAX_LEN];
uint8_t txBFCsnValue = 0; uint8_t txBFCsnValue = 0;
tSirSmeJoinReq *csr_join_req; tSirSmeJoinReq *csr_join_req;
tSirMacCapabilityInfo *pAP_capabilityInfo; tSirMacCapabilityInfo *pAP_capabilityInfo;
@@ -14027,6 +14035,14 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
status = QDF_STATUS_SUCCESS; status = QDF_STATUS_SUCCESS;
if (!QDF_IS_STATUS_SUCCESS(status)) if (!QDF_IS_STATUS_SUCCESS(status))
break; break;
wpaRsnIE = qdf_mem_malloc(DOT11F_IE_RSN_MAX_LEN);
if (NULL == wpaRsnIE)
status = QDF_STATUS_E_NOMEM;
if (!QDF_IS_STATUS_SUCCESS(status))
break;
csr_join_req->messageType = messageType; csr_join_req->messageType = messageType;
csr_join_req->length = msgLen; csr_join_req->length = msgLen;
csr_join_req->sessionId = (uint8_t) sessionId; csr_join_req->sessionId = (uint8_t) sessionId;
@@ -14693,6 +14709,9 @@ QDF_STATUS csr_send_join_req_msg(tpAniSirGlobal pMac, uint32_t sessionId,
if (!QDF_IS_STATUS_SUCCESS(status) && (NULL != csr_join_req)) if (!QDF_IS_STATUS_SUCCESS(status) && (NULL != csr_join_req))
qdf_mem_free(csr_join_req); qdf_mem_free(csr_join_req);
if (wpaRsnIE)
qdf_mem_free(wpaRsnIE);
return status; return status;
} }