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
This commit is contained in:
Hanumanth Reddy Pothula 2018-03-15 18:11:27 +05:30 • committed by nshrivas
commit 560d5713d6

View file

@ -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]);