summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaveen Rawat <naveenrawat@codeaurora.org>2018-01-04 14:56:25 -0800
committersnandini <snandini@codeaurora.org>2018-01-08 01:33:31 -0800
commitd04d3782008ec3528b65b385b3f65407ae2b5e08 (patch)
treed8d7ef9faf3ee6042fa2c53015c7894d8aea1428
parent552054705287fc46b0d6cb015b9c539936d0180c (diff)
qcacld-3.0: Fix memory leak in sme_rrm_issue_scan_req
Function sme_rrm_issue_scan_req issues scan request, which consumes an allocated channel list and frees it later. It should also free the scan list in same context for all the paths that do not issue the scan request or when the channel list is parsed completely. Fix the memory leak by making sure all such paths where scan request is not issued, channel list is freed. Change-Id: I561c3e03beaa5a809b5be1dd0c9dc73312e3c102 CRs-Fixed: 2166647
-rw-r--r--core/sme/src/rrm/sme_rrm.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/core/sme/src/rrm/sme_rrm.c b/core/sme/src/rrm/sme_rrm.c
index 41685cd0bfa9..cf59e8107e53 100644
--- a/core/sme/src/rrm/sme_rrm.c
+++ b/core/sme/src/rrm/sme_rrm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -656,12 +656,15 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
if (status != QDF_STATUS_SUCCESS) {
sme_err("sme session ID not found for bssid= "MAC_ADDRESS_STR,
MAC_ADDR_ARRAY(sme_rrm_ctx->sessionBssId.bytes));
- return QDF_STATUS_E_FAILURE;
+ status = QDF_STATUS_E_FAILURE;
+ goto free_ch_lst;
}
if ((sme_rrm_ctx->currentIndex) >=
- sme_rrm_ctx->channelList.numOfChannels)
- return status;
+ sme_rrm_ctx->channelList.numOfChannels) {
+ sme_debug("done with the complete ch lt. finish and fee now");
+ goto free_ch_lst;
+ }
if (eRRM_MSG_SOURCE_ESE_UPLOAD == sme_rrm_ctx->msgSource ||
eRRM_MSG_SOURCE_LEGACY_ESE == sme_rrm_ctx->msgSource)
@@ -770,6 +773,8 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
if (sme_rrm_ctx->ssId.length)
qdf_mem_free(scan_req.SSIDs.SSIDList);
+
+ return status;
} else if (eSIR_BEACON_TABLE == scan_type) {
/*
* In beacon table mode, scan results are taken directly from
@@ -790,6 +795,7 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
#ifdef FEATURE_WLAN_ESE
sme_rrm_ctx->eseBcnReqInProgress = false;
#endif
+ return status;
} else {
/*
* Done with the measurement. Clean up all context and
@@ -798,7 +804,7 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
sme_rrm_send_scan_result(mac_ctx, 1,
&sme_rrm_ctx->channelList.ChannelList[
sme_rrm_ctx->currentIndex], true);
- qdf_mem_free(sme_rrm_ctx->channelList.ChannelList);
+ goto free_ch_lst;
}
} else {
sme_err("Unknown beacon report req mode(%d)", scan_type);
@@ -808,7 +814,12 @@ static QDF_STATUS sme_rrm_issue_scan_req(tpAniSirGlobal mac_ctx)
* and PE will not handle subsequent Beacon requests
*/
sme_rrm_send_beacon_report_xmit_ind(mac_ctx, NULL, true, 0);
+ goto free_ch_lst;
}
+
+free_ch_lst:
+ qdf_mem_free(sme_rrm_ctx->channelList.ChannelList);
+ sme_rrm_ctx->channelList.ChannelList = NULL;
return status;
}
@@ -830,7 +841,6 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac,
tpSirBeaconReportReqInd pBeaconReq = (tpSirBeaconReportReqInd) pMsgBuf;
tpRrmSMEContext pSmeRrmContext = &pMac->rrm.rrmSmeContext;
uint32_t len = 0, i = 0;
- QDF_STATUS status = QDF_STATUS_SUCCESS;
sme_debug("Received Beacon report request ind Channel = %d",
pBeaconReq->channelInfo.channelNum);
@@ -922,16 +932,7 @@ QDF_STATUS sme_rrm_process_beacon_report_req_ind(tpAniSirGlobal pMac,
pSmeRrmContext->token, pSmeRrmContext->regClass,
pSmeRrmContext->randnIntvl, pSmeRrmContext->msgSource);
- status = sme_rrm_issue_scan_req(pMac);
-
- if (status != QDF_STATUS_SUCCESS) {
- if (pSmeRrmContext->channelList.ChannelList) {
- qdf_mem_free(pSmeRrmContext->channelList.ChannelList);
- pSmeRrmContext->channelList.ChannelList = NULL;
- }
- }
-
- return status;
+ return sme_rrm_issue_scan_req(pMac);
}
/**