[PATCH] wpa_supplicant: don't try to stop sched scan when initialization fails

Ilan Peer ilan.peer
Sun Nov 3 05:27:59 PST 2013

From: Luciano Coelho <luciano.coelho at intel.com>

If something goes wrong during initialization, we were trying to stop
schedule scan (and thus read data from wpa_s->drv_priv), but the
driver data doesn't exist, so we were segfaulting.  Fix this by not
trying to stop sched scans if the private driver data doesn't exist.

Signed-hostap: Luciano Coelho <luciano.coelho at intel.com>

 wpa_supplicant/wpa_supplicant.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 3301b14..f776d49 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -454,7 +454,9 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
-	wpa_supplicant_cancel_sched_scan(wpa_s);
+	/* no need to stop sched scans if the driver failed to initialize */
+	if (wpa_s->drv_priv)
+		wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_s->next_scan_freqs = NULL;

More information about the Hostap mailing list