From 5307d19a75682a1064994441e885b50ccd3bd613 Mon Sep 17 00:00:00 2001 From: Asutosh Mohapatra Date: Tue, 29 Nov 2022 18:19:31 +0530 Subject: [PATCH] qcacld-3.0: Restrict mode change to FTM mode scenarios Currently if driver load/unload is in progress or driver is loaded and mode change to FTM mode is issued from the sys path, memory leakage occurs during driver unload. To address this issue, don't change mode if driver is already loaded or load/unload is in progress. Change-Id: I09cacaf11d516c62de1a9699547eb01476afdc1f CRs-Fixed: 3349217 --- core/hdd/src/wlan_hdd_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 1ee2bb2b65d9..1c010f73e6df 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -18090,6 +18090,11 @@ static int con_mode_handler_ftm(const char *kmessage, ret = param_set_int(kmessage, kp); + if (cds_is_driver_loaded() || cds_is_load_or_unload_in_progress()) { + pr_err("Driver already loaded or load/unload in progress"); + return -ENOTSUPP; + } + if (con_mode_ftm != QDF_GLOBAL_FTM_MODE) { pr_err("Only FTM mode supported!"); return -ENOTSUPP;