diff --git a/src/eap_peer/eap.c b/src/eap_peer/eap.c index 74c2ad361..7dcfe4fff 100644 --- a/src/eap_peer/eap.c +++ b/src/eap_peer/eap.c @@ -1069,6 +1069,20 @@ SM_STATE(EAP, SUCCESS) wpa_msg(sm->msg_ctx, MSG_INFO, WPA_EVENT_EAP_SUCCESS "EAP authentication completed successfully"); + if (!config || !sm->m) { + /* + * This should not happen under normal conditions, but be more + * careful here since there was an earlier case where + * EAP-Success could end up getting delivered to the state + * machine for processing after the state had been cleaned with + * a call to eap_invalidate_cached_session() (and also + * eapol_sm_notify_config() having been used to clear EAP + * configuration in the EAPOL state machine). + */ + wpa_printf(MSG_DEBUG, + "EAP: State machine not configured - cannot initialize ERP"); + return; + } if (config->erp && sm->m->get_emsk && sm->eapSessionId && sm->m->isKeyAvailable && sm->m->isKeyAvailable(sm, sm->eap_method_priv))