Move ctrl_iface deinit into the end of interface deinit

This allows TERMINATING ctrl_iface event to be sent at the end of the
deinit sequence to avoid race conditions with new operations that this
event may trigger while wpa_supplicant would still be running through
the deinitialization path.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
This commit is contained in:
Dmitry Shmidt 2012-01-29 20:21:07 +02:00 committed by Jouni Malinen
parent 2523ff6ea4
commit f08115165b

View file

@ -400,16 +400,10 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
wpa_s->l2_br = NULL;
}
if (wpa_s->ctrl_iface) {
wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
wpa_s->ctrl_iface = NULL;
}
if (wpa_s->conf != NULL) {
struct wpa_ssid *ssid;
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next)
wpas_notify_network_removed(wpa_s, ssid);
wpa_config_free(wpa_s->conf);
wpa_s->conf = NULL;
}
os_free(wpa_s->confname);
@ -2419,6 +2413,19 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
if (notify)
wpas_notify_iface_removed(wpa_s);
if (terminate)
wpa_msg(wpa_s, MSG_INFO, WPA_EVENT_TERMINATING);
if (wpa_s->ctrl_iface) {
wpa_supplicant_ctrl_iface_deinit(wpa_s->ctrl_iface);
wpa_s->ctrl_iface = NULL;
}
if (wpa_s->conf != NULL) {
wpa_config_free(wpa_s->conf);
wpa_s->conf = NULL;
}
}