Clear WPA and EAPOL state machine config pointer on network removal

Make sure that the WPA and EAPOL state machines do not hold a pointer
to a network configuration that is about to be freed. This can fix
potential issues with references to freed memory.
This commit is contained in:
Jouni Malinen 2011-06-27 19:02:24 +03:00 committed by Jouni Malinen
parent 567afddb69
commit 20a0b03deb
3 changed files with 19 additions and 2 deletions

View file

@ -1393,6 +1393,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
}
if (wpa_s->current_ssid) {
eapol_sm_invalidate_cached_session(wpa_s->eapol);
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
wpa_supplicant_disassociate(wpa_s,
WLAN_REASON_DEAUTH_LEAVING);
}
@ -1416,6 +1418,8 @@ static int wpa_supplicant_ctrl_iface_remove_network(
* removed.
*/
eapol_sm_invalidate_cached_session(wpa_s->eapol);
wpa_sm_set_config(wpa_s->wpa, NULL);
eapol_sm_notify_config(wpa_s->eapol, NULL, NULL);
wpa_supplicant_disassociate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
}