wpa_supplicant: Fix access to the freed memory when removing all networks

Commit 59ff6653aa fixed this issue for
'removing a network', and we also need to take care of 'removing all
networks'.

Signed-hostap: Jaewan Kim <jaewan at google.com>
This commit is contained in:
Jaewan Kim 2013-02-03 21:22:59 +02:00 committed by Jouni Malinen
parent 5f7ae5e61c
commit 391f492532

View file

@ -2111,14 +2111,6 @@ static int wpa_supplicant_ctrl_iface_remove_network(
/* cmd: "<network id>" or "all" */
if (os_strcmp(cmd, "all") == 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: REMOVE_NETWORK all");
ssid = wpa_s->conf->ssid;
while (ssid) {
struct wpa_ssid *remove_ssid = ssid;
id = ssid->id;
ssid = ssid->next;
wpas_notify_network_removed(wpa_s, remove_ssid);
wpa_config_remove_network(wpa_s->conf, id);
}
eapol_sm_invalidate_cached_session(wpa_s->eapol);
if (wpa_s->current_ssid) {
#ifdef CONFIG_SME
@ -2129,6 +2121,14 @@ static int wpa_supplicant_ctrl_iface_remove_network(
wpa_supplicant_deauthenticate(
wpa_s, WLAN_REASON_DEAUTH_LEAVING);
}
ssid = wpa_s->conf->ssid;
while (ssid) {
struct wpa_ssid *remove_ssid = ssid;
id = ssid->id;
ssid = ssid->next;
wpas_notify_network_removed(wpa_s, remove_ssid);
wpa_config_remove_network(wpa_s->conf, id);
}
return 0;
}