From 57d3c5913aa2789e06311b99c2ab2c453f1f29f7 Mon Sep 17 00:00:00 2001 From: Hu Wang Date: Wed, 1 Mar 2017 16:39:30 +0200 Subject: [PATCH] Clear scan_res_handler on no-retry failure Previously it was possible for wpa_s->scan_res_handler to remain set to its old value in case wpa_drv_scan() failed and no retry for the scan trigger was scheduled (i.e., when last_scan_req == MANUAL_SCAN_REQ). This could result in getting stuck with the next connection attempt after a failed "SCAN TYPE=ONLY" operation when wpa_s->scan_res_handler was set to scan_only_handler(). Fix this by clearing wpa_s->scan_res_handler if wpa_drv_scan() fails and no retry is scheduled. Signed-off-by: Jouni Malinen --- wpa_supplicant/scan.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index f3ff4cdd8..f59f5e860 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -208,6 +208,9 @@ static void wpas_trigger_scan_cb(struct wpa_radio_work *work, int deinit) /* Restore scan_req since we will try to scan again */ wpa_s->scan_req = wpa_s->last_scan_req; wpa_supplicant_req_scan(wpa_s, 1, 0); + } else if (wpa_s->scan_res_handler) { + /* Clear the scan_res_handler */ + wpa_s->scan_res_handler = NULL; } return; }