summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiangwei Dong <liangwei@qti.qualcomm.com>2016-04-12 06:08:17 -0400
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2016-04-20 18:25:27 +0530
commit4a78183a189af59da1f9efa78464d761720bf360 (patch)
treeb0978120de3ff50b2044d309c62f49a81769334f
parent150a49fb99d2c8a84fa74c0034bced665898f9d3 (diff)
qcacld-2.0: Fix acs_cfg.ch_list memory leak
If ACS failed, the __wlan_hdd_cfg80211_stop_ap will not be called to free the ch_list. Add new API wlan_hdd_undo_acs to do cleanup of DO_ACS to free ch_list memory. And call the API in hdd_deinit_adapter to fix ch_list leak issue. CRs-Fixed: 1002207 Change-Id: If3285739f2387928a1d7578f9d14089a486a6d9e
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h3
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c40
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c1
3 files changed, 28 insertions, 16 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 19b666531c86..1a6538526b78 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -2085,4 +2085,7 @@ eHalStatus hdd_smeCloseSessionCallback(void *pContext);
int hdd_enable_disable_ca_event(hdd_context_t *hddctx,
tANI_U8 set_value);
+
+void wlan_hdd_undo_acs(hdd_adapter_t *adapter);
+
#endif // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index d20c4bbd5ca6..33cfdee506f8 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -8106,7 +8106,7 @@ out:
if (temp_skbuff != NULL)
return cfg80211_vendor_cmd_reply(temp_skbuff);
}
-
+ wlan_hdd_undo_acs(adapter);
clear_bit(ACS_IN_PROGRESS, &hdd_ctx->g_event_flags);
return status;
@@ -8139,6 +8139,26 @@ static int wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy,
}
/**
+ * wlan_hdd_undo_acs : Do cleanup of DO_ACS
+ * @adapter: Pointer to adapter struct
+ *
+ * This function handle cleanup of what was done in DO_ACS, including free
+ * memory.
+ *
+ * Return: void
+ */
+
+void wlan_hdd_undo_acs(hdd_adapter_t *adapter)
+{
+ if (adapter == NULL)
+ return;
+ if (adapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list) {
+ vos_mem_free(adapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list);
+ adapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list = NULL;
+ }
+}
+
+/**
* wlan_hdd_cfg80211_start_pending_acs : Start pending ACS procedure for SAP
* @work: Linux workqueue struct pointer for ACS work
*
@@ -13454,7 +13474,7 @@ static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy,
VOS_STATUS status = VOS_STATUS_E_FAILURE;
tSirUpdateIE updateIE;
beacon_data_t *old;
- int ret;
+ int ret = 0;
unsigned long rc;
hdd_adapter_list_node_t *pAdapterNode = NULL;
hdd_adapter_list_node_t *pNext = NULL;
@@ -13481,18 +13501,6 @@ static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy,
pAdapter->device_mode);
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
- ret = wlan_hdd_validate_context(pHddCtx);
- if (0 != ret) {
- if (pHddCtx->isUnloadInProgress) {
- /*
- * Unloading the driver so free the memory for ch_list,
- * otherwise it will result in memory leak
- */
- if (pAdapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list)
- vos_mem_free(pAdapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list);
- }
- return ret;
- }
status = hdd_get_front_adapter (pHddCtx, &pAdapterNode);
while (NULL != pAdapterNode && VOS_STATUS_SUCCESS == status) {
@@ -13537,8 +13545,8 @@ static int __wlan_hdd_cfg80211_stop_ap (struct wiphy *wiphy,
}
pAdapter->sessionCtx.ap.sapConfig.acs_cfg.acs_mode = false;
- if (pAdapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list)
- vos_mem_free(pAdapter->sessionCtx.ap.sapConfig.acs_cfg.ch_list);
+ wlan_hdd_undo_acs(pAdapter);
+
vos_mem_zero(&pAdapter->sessionCtx.ap.sapConfig.acs_cfg,
sizeof(struct sap_acs_cfg));
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 2f0995ed41b9..398eb681f30a 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -10390,6 +10390,7 @@ void hdd_deinit_adapter(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
hdd_wmm_adapter_close( pAdapter );
clear_bit(WMM_INIT_DONE, &pAdapter->event_flags);
}
+ wlan_hdd_undo_acs(pAdapter);
hdd_cleanup_actionframe(pHddCtx, pAdapter);