qcacld-3.0: Handle memory leak during start/stop SAP

Free beacon memory in all execution paths to avoid memory leak.

Change-Id: Ibc5f8c90a142891fd4e60c79ca5ed75c708ecad6
CRs-Fixed: 2682205
This commit is contained in:
Bapiraju Alla 2020-05-11 16:28:11 +05:30 • committed by nshrivas
commit 5cb4bcdee5

View file

@ -5822,21 +5822,21 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
* interval in not reset.
*/
if (ret)
return 0;
goto exit;
if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
hdd_err("Command not allowed in FTM mode");
return 0;
goto exit;
}
if (hdd_ctx->driver_status == DRIVER_MODULES_CLOSED) {
hdd_err("Driver module is closed; dropping request");
return 0;
goto exit;
}
if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) {
hdd_err("vdev is invalid. Hence return");
return 0;
goto exit;
}
qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
@ -5846,7 +5846,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
if (!(adapter->device_mode == QDF_SAP_MODE ||
adapter->device_mode == QDF_P2P_GO_MODE)) {
hdd_err("stop ap is given on device modes other than SAP/GO. Hence return");
return 0;
goto exit;
}
/* Clear SOFTAP_INIT_DONE flag to mark stop_ap deinit. So that we do
@ -5935,7 +5935,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
} else {
hdd_debug("SAP already down");
mutex_unlock(&hdd_ctx->sap_lock);
return 0;
goto exit;
}
mutex_unlock(&hdd_ctx->sap_lock);
@ -5946,7 +5946,7 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
if (status != QDF_STATUS_SUCCESS) {
hdd_err("Stopping the BSS");
return -EINVAL;
goto exit;
}
qdf_copy_macaddr(&update_ie.bssid, &adapter->mac_addr);
@ -5974,9 +5974,15 @@ static int __wlan_hdd_cfg80211_stop_ap(struct wiphy *wiphy,
ucfg_ftm_time_sync_update_bss_state(adapter->vdev,
FTM_TIME_SYNC_BSS_STOPPED);
exit:
if (adapter->session.ap.beacon) {
qdf_mem_free(adapter->session.ap.beacon);
adapter->session.ap.beacon = NULL;
}
hdd_exit();
return ret;
return 0;
}
/**
@ -6604,7 +6610,8 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy,
sizeof(*sta_inactivity_timer));
if (!sta_inactivity_timer) {
hdd_err("Failed to allocate Memory");
return QDF_STATUS_E_FAILURE;
status = QDF_STATUS_E_FAILURE;
goto err_start_bss;
}
sta_inactivity_timer->session_id = adapter->vdev_id;
sta_inactivity_timer->sta_inactivity_timeout =