Mark authorization completed on driver indication during 4-way HS offload

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>
This commit is contained in:
Vinayak Yadawad 2022-06-30 09:37:53 +05:30 committed by Jouni Malinen
parent da2ec9459c
commit 4163860605

View 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); eapol_sm_notify_eap_success(wpa_s->eapol, true);
} else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) && } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_PSK) &&
wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) { wpa_key_mgmt_wpa_psk(wpa_s->key_mgmt)) {
/* if (already_authorized) {
* We are done; the driver will take care of RSN 4-way /*
* handshake. * 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); wpa_supplicant_cancel_auth_timeout(wpa_s);
eapol_sm_notify_portValid(wpa_s->eapol, true); wpa_supplicant_set_state(wpa_s, WPA_COMPLETED);
eapol_sm_notify_eap_success(wpa_s->eapol, true); 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) && } else if ((wpa_s->drv_flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X) &&
wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) { wpa_key_mgmt_wpa_ieee8021x(wpa_s->key_mgmt)) {
/* /*