diff options
| author | Jeff Johnson <jjohnson@qca.qualcomm.com> | 2014-02-17 10:21:42 -0800 |
|---|---|---|
| committer | Akash Patel <c_akashp@qca.qualcomm.com> | 2014-02-18 01:00:27 -0800 |
| commit | d9b47e66704e54dcd987c042fcf3ea6a7bd286bf (patch) | |
| tree | 6f9f2029f1a7b95258d89fc75b76f66036c2f10d | |
| parent | cf0172860e158816c9be42343d735465a7a55b8d (diff) | |
qcacld: Fix memory leak in wlan_hdd_cfg80211_inform_bss_frame()
Static source code analysis identified a memory allocation in
wlan_hdd_cfg80211_inform_bss_frame() which could be leaked in some
code paths, so modify the code to relocate the allocation.
Change-Id: I7cf8e215cc2a44b68f880d96a2d23ea7db040d68
CRs-fixed: 617687
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index c68c9de4e9f2..b47bba31b23e 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -4397,8 +4397,7 @@ wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, ((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL); unsigned int freq; struct ieee80211_channel *chan; - struct ieee80211_mgmt *mgmt = - kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); + struct ieee80211_mgmt *mgmt; struct cfg80211_bss *bss_status = NULL; size_t frame_len = sizeof (struct ieee80211_mgmt) + ie_length; int rssi = 0; @@ -4412,6 +4411,12 @@ wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, pHddCtx = WLAN_HDD_GET_CTX(pAdapter); status = wlan_hdd_validate_context(pHddCtx); + if (0 != status) + { + VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, + "%s: HDD context is not valid", __func__); + return NULL; + } /*bss_update is not allowed during wlan driver loading or unloading*/ if ((pHddCtx->isLoadInProgress) || @@ -4422,15 +4427,7 @@ wlan_hdd_cfg80211_inform_bss_frame( hdd_adapter_t *pAdapter, return NULL; } - - if (0 != status) - { - VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, - "%s: HDD context is not valid", __func__); - return NULL; - } - - + mgmt = kzalloc((sizeof (struct ieee80211_mgmt) + ie_length), GFP_KERNEL); if (!mgmt) { VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, |
