diff mbox

hostapd: Clean interface_added flag

Message ID 1386927156-3973-1-git-send-email-marek.kwaczynski@tieto.com
State Accepted
Headers show

Commit Message

Marek Kwaczynski Dec. 13, 2013, 9:32 a.m. UTC
If more BSS networks are added in config file than are
supported by the driver, segmantation fault can appear.
For this case clean interface_added flag is needed when
adding new BSS failed.

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

Without this fix I saw segmantation fault or
"wlan0: Could not connect to kernel driver" in hostapd
when I added more BSS networks in config file than are
supported by the driver. For example when I created the
following BSSs in config file:
1) wlan0
2) wlan0-1
3) wlan0-2
4) wlan0-3

and the last one couldn't be added because it wasn't supported
by the driver, I received the following debug print:

nl80211: Adding interface wlan0-3 into bridge br-lan
Could not set interface wlan0-3 flags (UP): Device or resource
busy

After that when I killed hostapd, it tried to remove wlan0-3
and delete global bss pointer - wlan0


 src/ap/hostapd.c |    1 +
 1 file changed, 1 insertion(+)

Comments

Jouni Malinen Dec. 15, 2013, 5:59 a.m. UTC | #1
On Fri, Dec 13, 2013 at 10:32:36AM +0100, Marek Kwaczynski wrote:
> If more BSS networks are added in config file than are
> supported by the driver, segmantation fault can appear.
> For this case clean interface_added flag is needed when
> adding new BSS failed.

Thanks, applied.
diff mbox

Patch

diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 6fe2956..a436c2a 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -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;
 		}
 	}