mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
qcacld-3.0: Fix memory leak in hdd cfg80211
Fix SAP channel_info leak when updating ACS config, and skb leak when sending HW mode changed event. CRs-Fixed: 2273544 Change-Id: Ib08ecbcff6acdc5f3b47ec20969e97b6bfca6da3
This commit is contained in:
parent
1251ac1e16
commit
fac7797657
1 changed files with 15 additions and 12 deletions
|
|
@ -1858,15 +1858,6 @@ static int hdd_update_reg_chan_info(struct hdd_adapter *adapter,
|
|||
tsap_config_t *sap_config = &adapter->session.ap.sap_config;
|
||||
mac_handle_t mac_handle;
|
||||
|
||||
/* memory allocation */
|
||||
sap_config->channel_info = qdf_mem_malloc(
|
||||
sizeof(struct hdd_channel_info) *
|
||||
channel_count);
|
||||
if (!sap_config->channel_info) {
|
||||
hdd_err("memory allocation failed");
|
||||
return -ENOMEM;
|
||||
|
||||
}
|
||||
mac_handle = hdd_ctx->mac_handle;
|
||||
sap_config->channel_info_count = channel_count;
|
||||
for (i = 0; i < channel_count; i++) {
|
||||
|
|
@ -2110,7 +2101,6 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
|
|||
enum qca_wlan_vendor_attr_external_acs_policy acs_policy;
|
||||
uint32_t i;
|
||||
|
||||
|
||||
if (!hdd_ctx) {
|
||||
hdd_err("HDD context is NULL");
|
||||
return -EINVAL;
|
||||
|
|
@ -2160,6 +2150,14 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
|
|||
band);
|
||||
}
|
||||
|
||||
sap_config->channel_info = qdf_mem_malloc(
|
||||
sizeof(struct hdd_channel_info) *
|
||||
channel_count);
|
||||
if (!sap_config->channel_info) {
|
||||
hdd_err("memory allocation failed");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
hdd_update_reg_chan_info(adapter, channel_count, channel_list);
|
||||
hdd_get_freq_list(channel_list, freq_list, channel_count);
|
||||
/* Get phymode */
|
||||
|
|
@ -2173,6 +2171,7 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
|
|||
|
||||
if (!skb) {
|
||||
hdd_err("cfg80211_vendor_event_alloc failed");
|
||||
qdf_mem_free(sap_config->channel_info);
|
||||
return -ENOMEM;
|
||||
}
|
||||
/*
|
||||
|
|
@ -2247,7 +2246,6 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
|
|||
status = hdd_cfg80211_update_channel_info(skb, sap_config,
|
||||
QCA_WLAN_VENDOR_ATTR_EXTERNAL_ACS_EVENT_CHAN_INFO);
|
||||
|
||||
qdf_mem_free(sap_config->channel_info);
|
||||
if (status != 0)
|
||||
goto fail;
|
||||
|
||||
|
|
@ -2259,8 +2257,11 @@ int hdd_cfg80211_update_acs_config(struct hdd_adapter *adapter,
|
|||
goto fail;
|
||||
|
||||
cfg80211_vendor_event(skb, GFP_KERNEL);
|
||||
qdf_mem_free(sap_config->channel_info);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
qdf_mem_free(sap_config->channel_info);
|
||||
if (skb)
|
||||
kfree_skb(skb);
|
||||
return status;
|
||||
|
|
@ -14023,8 +14024,10 @@ int wlan_hdd_send_mode_change_event(void)
|
|||
}
|
||||
|
||||
for (mac_id = 0; mac_id < MAX_MAC; mac_id++) {
|
||||
if (wlan_hdd_fill_mac_info(skb, info, mac_id, conn_count))
|
||||
if (wlan_hdd_fill_mac_info(skb, info, mac_id, conn_count)) {
|
||||
kfree_skb(skb);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
nla_nest_end(skb, attr);
|
||||
|
|
|
|||
Loading…
Reference in a new issue