From: Dmitry Shmidt Date: Sun, 29 Jan 2012 18:21:07 +0000 (+0200) Subject: Move ctrl_iface deinit into the end of interface deinit X-Git-Tag: aosp-jb-start~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f08115165bd0a1a16c2902e9a61d9b579abdb42e;p=thirdparty%2Fhostap.git 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 --- diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 6d622b82b..b686c529b 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -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; + } }