]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
hostapd: Prevent double interface disabling from segfaulting
authorMichal Kazior <michal.kazior@tieto.com>
Wed, 28 May 2014 09:57:10 +0000 (11:57 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 31 May 2014 12:46:45 +0000 (15:46 +0300)
Performing, e.g. `wpa_cli -p /var/run/hostapd raw DISABLE` twice led to
hostapd segmentation fault if multiple BSSes were configured. Fix this
by checking if there is anything to disable at all before trying.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
src/ap/hostapd.c

index 243f4117a1a53b618e1f1feb005c3c5ee148d0a7..784da2a4a86a35ec8772ecc136d3977fec0b5a8a 100644 (file)
@@ -1692,6 +1692,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_INFO, "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;