mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
qcacld-3.0: Fix FTM mode malfunction and memory leak
Current driver will create two apdaters in FTM mode, with device_mode STA and P2P, where STA is incorrect and P2P is unnecessary. And those types will cause memory leak in qdf_mem_malloc()/sme_deregister_mgmt_frame(), when unloading driver. Also, it is improper to fix the interface name to wlan0 for FTM mode, as some platforms may use different naming rule. Only create one adapter with FTM mode, with variable interface name. CRs-Fixed: 2160513 Change-Id: If3bf4444e5535e6fe88c3ad2d87da217534984a0
This commit is contained in:
parent
876c1a6d35
commit
1c67848386
1 changed files with 13 additions and 5 deletions
|
|
@ -2102,6 +2102,8 @@ int hdd_start_adapter(struct hdd_adapter *adapter)
|
|||
ret = hdd_start_ftm_adapter(adapter);
|
||||
if (ret)
|
||||
goto err_start_adapter;
|
||||
else
|
||||
goto ftm_complete;
|
||||
break;
|
||||
default:
|
||||
hdd_err("Invalid session type %d", device_mode);
|
||||
|
|
@ -2121,6 +2123,7 @@ int hdd_start_adapter(struct hdd_adapter *adapter)
|
|||
goto err_start_adapter;
|
||||
}
|
||||
|
||||
ftm_complete:
|
||||
EXIT();
|
||||
return 0;
|
||||
err_start_adapter:
|
||||
|
|
@ -4337,7 +4340,7 @@ struct hdd_adapter *hdd_open_adapter(struct hdd_context *hdd_ctx, uint8_t sessio
|
|||
case QDF_FTM_MODE:
|
||||
adapter = hdd_alloc_station_adapter(hdd_ctx, macAddr,
|
||||
name_assign_type,
|
||||
"wlan0");
|
||||
iface_name);
|
||||
if (NULL == adapter) {
|
||||
hdd_err("Failed to allocate adapter for FTM mode");
|
||||
return NULL;
|
||||
|
|
@ -8422,14 +8425,19 @@ static int hdd_open_interfaces(struct hdd_context *hdd_ctx, bool rtnl_held)
|
|||
int ret;
|
||||
|
||||
/* open monitor mode adapter if con_mode is monitor mode */
|
||||
if (con_mode == QDF_GLOBAL_MONITOR_MODE) {
|
||||
adapter = hdd_open_adapter(hdd_ctx, QDF_MONITOR_MODE, "wlan%d",
|
||||
wlan_hdd_get_intf_addr(hdd_ctx),
|
||||
NET_NAME_UNKNOWN, rtnl_held);
|
||||
if (con_mode == QDF_GLOBAL_MONITOR_MODE ||
|
||||
con_mode == QDF_GLOBAL_FTM_MODE) {
|
||||
uint8_t session_type = (con_mode == QDF_GLOBAL_MONITOR_MODE) ?
|
||||
QDF_MONITOR_MODE : QDF_FTM_MODE;
|
||||
|
||||
adapter = hdd_open_adapter(hdd_ctx, session_type, "wlan%d",
|
||||
wlan_hdd_get_intf_addr(hdd_ctx),
|
||||
NET_NAME_UNKNOWN, rtnl_held);
|
||||
if (!adapter) {
|
||||
hdd_err("open adapter failed");
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue