]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Mark authorization completed on driver indication during 4-way HS offload
authorVinayak Yadawad <vinayak.yadawad@broadcom.com>
Thu, 30 Jun 2022 04:07:53 +0000 (09:37 +0530)
committerJouni Malinen <j@w1.fi>
Sun, 27 Nov 2022 12:18:53 +0000 (14:18 +0200)
In case of drivers supporting 4-way handshake offload, mark port
authorized and state completion only if the driver advertizes authorized
state in the connect event. Otherwise there are fair chances of the
driver port authorization API getting called while 4-way handshake is in
progress at the lower layer.

In order to avoid this possible race condition always update port
authorization and supplicant state WPA_COMPLETED setting from
EVENT_PORT_AUTHORIZED context when the driver is done with the 4-way
handshake.

Signed-off-by: Vinayak Yadawad <vinayak.yadawad@broadcom.com>
wpa_supplicant/events.c

index 35f3694a0be26a64dc5fe18cb1ba3e6ea6e4e59d..788ef5bdfefbc6369122a93ce7d6441616700984 100644 (file)
@@ -3671,14 +3671,23 @@ static void wpa_supplicant_event_assoc(struct wpa_supplicant *wpa_s,
                eapol_sm_notify_eap_success(wpa_s->eapol, true);
        } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) &&
                   wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
-               /*
-                * We are done; the driver will take care of RSN 4-way
-                * handshake.
-                */
-               wpa_supplicant_cancel_auth_timeout(wpa_s);
-               wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
-               eapol_sm_notify_portValid(wpa_s->eapol, true);
-               eapol_sm_notify_eap_success(wpa_s->eapol, true);
+               if (already_authorized) {
+                       /*
+                        * We are done; the driver will take care of RSN 4-way
+                        * handshake.
+                        */
+                       wpa_supplicant_cancel_auth_timeout(wpa_s);
+                       wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
+                       eapol_sm_notify_portValid(wpa_s->eapol, true);
+                       eapol_sm_notify_eap_success(wpa_s->eapol, true);
+               } else {
+                       /* Update port, WPA_COMPLETED state from the
+                        * EVENT_PORT_AUTHORIZED handler when the driver is done
+                        * with the 4-way handshake.
+                        */
+                       wpa_msg(wpa_s, MSG_DEBUG,
+                               "ASSOC INFO: wait for driver port authorized indication");
+               }
        } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) &&
                   wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) {
                /*