From: Jouni Malinen Date: Sun, 1 Nov 2015 18:26:35 +0000 (+0200) Subject: Restore previous wpa_state in scan-only result handler X-Git-Tag: hostap_2_6~1413 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea6030c77f119056868e9b8df06f3200943c61ef;p=thirdparty%2Fhostap.git Restore previous wpa_state in scan-only result handler The SCAN TYPE=ONLY results do not trigger a connection operation automatically. As such, there was no explicit operation that would change wpa_state after such a scan-only operation and WPA_SCANNING state could have been left in effect until the next operation is triggered by an external command. This is not desirable, so restore the wpa_state that was in use when the scan was started in case WPA_SCANNING state is still set when the scan operation completes. This was triggered by the following mac80211_hwsim test sequence: dbus_wps_oom scan_trigger_failure Signed-off-by: Jouni Malinen --- diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 2b41ca891..076766ea2 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -2148,6 +2148,9 @@ void scan_only_handler(struct wpa_supplicant *wpa_s, wpa_s->scan_work = NULL; radio_work_done(work); } + + if (wpa_s->wpa_state == WPA_SCANNING) + wpa_supplicant_set_state(wpa_s, wpa_s->scan_prev_wpa_state); }