]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
WPS: Fix a race condition on WPS_CANCEL handling
authorJouni Malinen <j@w1.fi>
Fri, 27 Dec 2024 21:49:57 +0000 (23:49 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 27 Dec 2024 21:49:57 +0000 (23:49 +0200)
If the WPS_CANCEL command were issued between the driver command
requesting association and the driver event indicating completion of
association, i.e., within the WPA_ASSOCIATING state, it was possible for
the association to continue and the WPS procedure to be completed after
this.

Address this by forcing deauthentication and WPS state clearing also in
the WPS_ASSOCIATING state and not only if the association has been
completed.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/wps_supplicant.c

index 7b9cf7f9e510d5500d4593b23bc83b09d4af8b8f..d332f000c32b4e141da2a7abeef9dc23f30f7a83 100644 (file)
@@ -1375,7 +1375,7 @@ int wpas_wps_cancel(struct wpa_supplicant *wpa_s)
                wpa_printf(MSG_DEBUG, "WPS: Cancel operation - cancel scan");
                wpa_supplicant_cancel_scan(wpa_s);
                wpas_clear_wps(wpa_s);
-       } else if (wpa_s->wpa_state >= WPA_ASSOCIATED) {
+       } else if (wpa_s->wpa_state >= WPA_ASSOCIATING) {
                wpa_printf(MSG_DEBUG, "WPS: Cancel operation - "
                           "deauthenticate");
                wpa_s->own_disconnect_req = 1;