summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManjeet Singh <c_manjee@qti.qualcomm.com>2016-05-16 19:17:36 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-05-26 18:13:34 +0530
commit954c4a56dbbd910cf42ee998b01da12686dc5906 (patch)
tree5cda30a7422dc7c3aec0644a447635853095f373
parent566f41776c174409626dc630cb6851d1387d7f14 (diff)
qcacld-2.0: Fix use of uninitialized data
In RoamReadTSF function, bss description field is read without checking the value of initializing function which can result in a null pointer exception. Check the return value of function NeighborRoamGetHandoffAPInfo which will fetch neighboring hand-off information. Change-Id: I74288d09b1c1cb8e4e7c65881a6fbc67010b4670 CRs-Fixed: 1017942
-rw-r--r--CORE/SME/inc/csrNeighborRoam.h4
-rw-r--r--CORE/SME/src/csr/csrApiRoam.c22
2 files changed, 16 insertions, 10 deletions
diff --git a/CORE/SME/inc/csrNeighborRoam.h b/CORE/SME/inc/csrNeighborRoam.h
index 6b5a3d6875d6..1de1430f345c 100644
--- a/CORE/SME/inc/csrNeighborRoam.h
+++ b/CORE/SME/inc/csrNeighborRoam.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -357,7 +357,7 @@ eHalStatus csrNeighborRoamStartLfrScan(tpAniSirGlobal pMac, tANI_U8 sessionId);
VOS_STATUS csrSetCCKMIe(tpAniSirGlobal pMac, const tANI_U8 sessionId,
const tANI_U8 *pCckmIe,
const tANI_U8 ccKmIeLen);
-VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp,
+eHalStatus csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp,
const tANI_U8 sessionId);
#endif /*FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index 4ba0dadc193f..43c43262f0fa 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -19015,11 +19015,14 @@ void csrRoamFTPreAuthRspProcessor( tHalHandle hHal, tpSirFTPreAuthRsp pFTPreAuth
eCSR_ROAM_FT_RESPONSE, eCSR_ROAM_RESULT_NONE);
#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
- if (csrRoamIsESEAssoc(pMac, pFTPreAuthRsp->smeSessionId))
- {
+ if (csrRoamIsESEAssoc(pMac, pFTPreAuthRsp->smeSessionId)) {
/* read TSF */
- csrRoamReadTSF(pMac, (tANI_U8 *)roamInfo.timestamp,
- pFTPreAuthRsp->smeSessionId);
+ status = csrRoamReadTSF(pMac, (tANI_U8 *)roamInfo.timestamp,
+ pFTPreAuthRsp->smeSessionId);
+ if (eHAL_STATUS_SUCCESS != status) {
+ smsLog(pMac, LOGE, FL("TSF read failed.Timestamp may be invalid"));
+ return;
+ }
// Save the bssid from the received response
vos_mem_copy((void *)&roamInfo.bssid,
(void *)pFTPreAuthRsp->preAuthbssId, sizeof(tCsrBssid));
@@ -19281,16 +19284,18 @@ VOS_STATUS csrSetCCKMIe(tpAniSirGlobal pMac, const tANI_U8 sessionId,
\param pTimestamp - output TSF time stamp
\- return Success or failure
-------------------------------------------------------------------------*/
-VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp,
+eHalStatus csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp,
tANI_U8 sessionId)
{
- eHalStatus status = eHAL_STATUS_SUCCESS;
tCsrNeighborRoamBSSInfo handoffNode = {{0}};
tANI_U32 timer_diff = 0;
tANI_U32 timeStamp[2];
tpSirBssDescription pBssDescription = NULL;
- csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode, sessionId);
+ if (!csrNeighborRoamGetHandoffAPInfo(pMac, &handoffNode, sessionId)) {
+ smsLog(pMac, LOGE, FL("invalid handoff node"));
+ return eHAL_STATUS_FAILURE;
+ }
pBssDescription = handoffNode.pBssDescription;
// Get the time diff in milli seconds
timer_diff = vos_timer_get_system_time() - pBssDescription->scanSysTimeMsec;
@@ -19301,7 +19306,8 @@ VOS_STATUS csrRoamReadTSF(tpAniSirGlobal pMac, tANI_U8 *pTimestamp,
UpdateCCKMTSF(&(timeStamp[0]), &(timeStamp[1]), &timer_diff);
vos_mem_copy(pTimestamp, (void *) &timeStamp[0],
sizeof (tANI_U32) * 2);
- return status;
+
+ return eHAL_STATUS_SUCCESS;
}
#endif /*FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */