[PATCH 06/10] wpa_supplicant: Handle race condition in sched_scan stop

Andrei Otcheretianski andrei.otcheretianski at intel.com
Thu Oct 27 05:18:28 PDT 2016


From: Roee Zamir <roee.zamir at intel.com>

In case that stop sched command is sent after the completion of
scheduled scan and before the processing of the
EVENT_SCHED_SCAN_STOPPED event, stopping the scheduled scan would
fail, in such a case do not set the sched_scan_stop_req flag.

Signed-off-by: Roee Zamir <roee.zamir at intel.com>
---
 wpa_supplicant/scan.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 2f4621f..afda35e 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -2550,7 +2550,14 @@ int wpas_stop_pno(struct wpa_supplicant *wpa_s)
 		return 0;
 
 	ret = wpa_supplicant_stop_sched_scan(wpa_s);
-	wpa_s->sched_scan_stop_req = 1;
+
+	/* In case that stop sched command is sent after the completion of
+	 * sched scan and before processing the EVENT_SCHED_SCAN_STOPPED event,
+	 * stopping the scheduled scan would fail.
+	 * In such a case do not set the flag
+	 */
+	if (!ret)
+		wpa_s->sched_scan_stop_req = 1;
 
 	wpa_s->pno = 0;
 	wpa_s->pno_sched_pending = 0;
-- 
1.9.1




More information about the Hostap mailing list