[PATCH] driver_nl80211: fix hostapd error path

Johannes Berg johannes
Fri Oct 21 07:01:44 PDT 2011


From: Johannes Berg <johannes.berg at intel.com>

i802_init() tries to clean up everything manually,
call wpa_driver_nl80211_deinit() instead and also
handle the EAPOL socket properly.
---
 src/drivers/driver_nl80211.c |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 28b3fb4..6a9c7d7 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6416,6 +6416,8 @@ static void *i802_init(struct hostapd_data *hapd,
 
 	drv = bss->drv;
 	drv->nlmode = NL80211_IFTYPE_AP;
+	drv->eapol_sock = -1;
+
 	if (linux_br_get(brname, params->ifname) == 0) {
 		wpa_printf(MSG_DEBUG, "nl80211: Interface %s is in bridge %s",
 			   params->ifname, brname);
@@ -6483,19 +6485,11 @@ static void *i802_init(struct hostapd_data *hapd,
 	return bss;
 
 failed:
-	nl80211_remove_monitor_interface(drv);
-	rfkill_deinit(drv->rfkill);
-	netlink_deinit(drv->netlink);
-	if (drv->ioctl_sock >= 0)
-		close(drv->ioctl_sock);
-
-	genl_family_put(drv->nl80211);
-	nl_cache_free(drv->nl_cache);
-	nl80211_handle_destroy(drv->nl_handle);
-	nl_cb_put(drv->nl_cb);
-	eloop_unregister_read_sock(nl_socket_get_fd(drv->nl_handle_event));
-
-	os_free(drv);
+	if (drv->eapol_sock >= 0) {
+		eloop_unregister_read_sock(drv->eapol_sock);
+		close(drv->eapol_sock);
+	}
+	wpa_driver_nl80211_deinit(bss);
 	return NULL;
 }
 





More information about the Hostap mailing list