From 3bc5e981b161e97389fad1b11a5c90bbea017780 Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Fri, 24 Nov 2017 15:53:49 +0530 Subject: [PATCH] qcacld-3.0: Wait for external threads to complete before con mode switch Interface up runs in normal mode (wifi@1.0-service) and it gets preempted by the con_mode change handler when Monitor mode is invoked via user. Then again when the normal mode gets scheduled after the completion of Monitor mode, it tries to access contents freed during the con_mode change. The __con_mode_handler is made to wait for the external threads to complete before making the con mode switch Change-Id: I245b6b6f855e119a11422677da161a43c1184069 CRs-fixed: 2147499 --- core/hdd/src/wlan_hdd_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 9466dec8bdc0..2891874ca438 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -11836,6 +11836,9 @@ static int __con_mode_handler(const char *kmessage, struct kernel_param *kp, goto reset_flags; } + if (!cds_wait_for_external_threads_completion(__func__)) + hdd_warn("Waiting for monitor mode: External threads are active"); + /* ensure adapters are stopped */ hdd_stop_present_mode(hdd_ctx, curr_mode);