From 560d5713d6997c7cb8ff898305b9ec52adcbab96 Mon Sep 17 00:00:00 2001 From: Hanumanth Reddy Pothula Date: Thu, 15 Mar 2018 18:11:27 +0530 Subject: [PATCH] qcacld-3.0: Reset acs configuration after freeing acs channel list Presently, on receiving DO_ACS vendor command driver resets acs configuration to zero. This leads dynamically allocated memory acs channel list address to be lost and thereby memory leak is observed. Reset acs configuration after freeing acs channel list, if its already allocated. Change-Id: Ice6854bfe8b12799200a5b18d96620f31548d776 CRs-Fixed: 2196377 --- core/hdd/src/wlan_hdd_cfg80211.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index dbc82f93b068..e7dcef6b052d 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -2527,11 +2527,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, goto out; } - sap_config = &adapter->session.ap.sap_config; - if (sap_config->acs_cfg.ch_list) - qdf_mem_free(sap_config->acs_cfg.ch_list); - qdf_mem_zero(&sap_config->acs_cfg, sizeof(struct sap_acs_cfg)); - ret = wlan_cfg80211_nla_parse(tb, QCA_WLAN_VENDOR_ATTR_ACS_MAX, data, data_len, wlan_hdd_cfg80211_do_acs_policy); @@ -2595,6 +2590,13 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, ch_width = 20; } + sap_config = &adapter->session.ap.sap_config; + + /* Check and free if memory is already allocated for acs channel list */ + wlan_hdd_undo_acs(adapter); + + qdf_mem_zero(&sap_config->acs_cfg, sizeof(struct sap_acs_cfg)); + hdd_debug("channel width =%d", ch_width); if (ch_width == 160) sap_config->acs_cfg.ch_width = CH_WIDTH_160MHZ; @@ -2615,7 +2617,6 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, * is present */ - wlan_hdd_undo_acs(adapter); if (tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]) { char *tmp = nla_data(tb[QCA_WLAN_VENDOR_ATTR_ACS_CH_LIST]);