hostapd: Clear interface_added flag on error path
authorMarek Kwaczynski <marek.kwaczynski@tieto.com>
Fri, 13 Dec 2013 09:32:36 +0000 (10:32 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 15 Dec 2013 05:13:52 +0000 (21:13 -0800)
If more BSSes are added in config file than are supported by the driver,
segmentation fault can appear. For this case, the interface_added flag
needs to be cleared if adding a new BSS fails.

Signed-hostap: Marek Kwaczynski <marek.kwaczynski@tieto.com>

src/ap/hostapd.c

index 6fe2956..a436c2a 100644 (file)
@@ -667,6 +667,7 @@ static int hostapd_setup_bss(struct hostapd_data *hapd, int first)
                                   NULL, first == -1)) {
                        wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
                                   MACSTR ")", MAC2STR(hapd->own_addr));
+                       hapd->interface_added = 0;
                        return -1;
                }
        }