[PATCH 2/4] hostapd: Prevent double interface disabling from segfaulting
Michal Kazior
michal.kazior
Wed May 28 02:57:10 PDT 2014
Performing, e.g. `wpa_cli -p /var/run/hostapd raw DISABLE` twice led to
hostapd segmentation fault. Fix this by checking if there is anything to
disable at all before trying.
Signed-off-by: Michal Kazior <michal.kazior at tieto.com>
---
src/ap/hostapd.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index b7e118c..f5657d6 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1688,6 +1688,13 @@ int hostapd_disable_iface(struct hostapd_iface *hapd_iface)
if (hapd_iface == NULL)
return -1;
+
+ if (hapd_iface->bss[0]->drv_priv == NULL) {
+ wpa_printf(MSG_ERROR, "Interface %s already disabled",
+ hapd_iface->conf->bss[0]->iface);
+ return -1;
+ }
+
wpa_msg(hapd_iface->bss[0]->msg_ctx, MSG_INFO, AP_EVENT_DISABLED);
driver = hapd_iface->bss[0]->driver;
drv_priv = hapd_iface->bss[0]->drv_priv;
--
1.8.5.3
More information about the Hostap
mailing list