qcacld-3.0: Open WLAN adapter in FTM mode after modules are started

According to the current code flow of con_mode_handler, the
WLAN modules are stopped, adapter is opened in FTM mode and then
the modules are started. Due to the INI/CFG value accces done as
part of opening the adapter, and since the modules are stopped
at this point, it results in a use after free scenario.

Modify code sequence of con_mode_handler to WLAN start modules
before opening the adapter in FTM mode.

Change-Id: I94afb9b2a3751247b4ae95e27b1374b25890a9d7
CRs-Fixed: 2339777
This commit is contained in:
jitiphil
2018-10-26 16:06:27 +05:30
committed by nshrivas
parent 98ad588d41
commit 7af5cf252a

View File

@@ -13326,18 +13326,18 @@ static int __con_mode_handler(const char *kmessage,
hdd_set_conparam(next_mode);
errno = hdd_open_adapters_for_mode(hdd_ctx, next_mode);
if (errno) {
hdd_err("Failed to open adapters");
goto unlock;
}
errno = hdd_wlan_start_modules(hdd_ctx, false);
if (errno) {
hdd_err("Start wlan modules failed: %d", errno);
goto unlock;
}
errno = hdd_open_adapters_for_mode(hdd_ctx, next_mode);
if (errno) {
hdd_err("Failed to open adapters");
goto unlock;
}
if (next_mode == QDF_GLOBAL_MONITOR_MODE) {
struct hdd_adapter *adapter =
hdd_get_adapter(hdd_ctx, QDF_MONITOR_MODE);