From 476dea24fffca37ebc1011840449e89ed4b8f49a Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 6 Jun 2012 22:07:11 +0300 Subject: [PATCH] WPS: Cancel WPS operation also in DISCONNECTED state It is possible for wpa_state to be WPA_DISCONNECTED when a new scan is scheduled to be started in the future. If wpas_wps_cancel() gets called (e.g., through control interface wps_cancel or a P2P group removal) while in that state, the WPS operation (scan request and special network block) were not removed. Fix this by clearing the WPS operations both in WPA_SCANNING and WPA_DISCONNECTED states. Signed-hostap: Jouni Malinen intended-for: hostap-1 --- wpa_supplicant/wps_supplicant.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c index 8e671f941..78e116695 100644 --- a/wpa_supplicant/wps_supplicant.c +++ b/wpa_supplicant/wps_supplicant.c @@ -920,7 +920,8 @@ int wpas_wps_cancel(struct wpa_supplicant *wpa_s) } #endif /* CONFIG_AP */ - if (wpa_s->wpa_state == WPA_SCANNING) { + if (wpa_s->wpa_state == WPA_SCANNING || + wpa_s->wpa_state == WPA_DISCONNECTED) { wpa_printf(MSG_DEBUG, "WPS: Cancel operation - cancel scan"); wpa_supplicant_cancel_scan(wpa_s); wpas_clear_wps(wpa_s);