]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Do not add interface to the global list in case of failure
authorJohannes Berg <johannes.berg@intel.com>
Tue, 22 Mar 2011 13:52:04 +0000 (15:52 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 22 Mar 2011 13:52:04 +0000 (15:52 +0200)
This avoids leaving a freed interface on the global list in case
driver initialization fails.

src/drivers/driver_nl80211.c

index 07f56b9af5f5d0a8c3f002a027a7891ed17891d6..ed82722027efb50de0052541ad78cf52c13a301a 100644 (file)
@@ -1816,8 +1816,6 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname,
        if (drv == NULL)
                return NULL;
        drv->global = global_priv;
-       if (drv->global)
-               dl_list_add(&drv->global->interfaces, &drv->list);
        drv->ctx = ctx;
        bss = &drv->first_bss;
        bss->drv = drv;
@@ -1867,6 +1865,9 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname,
        if (wpa_driver_nl80211_finish_drv_init(drv))
                goto failed;
 
+       if (drv->global)
+               dl_list_add(&drv->global->interfaces, &drv->list);
+
        return bss;
 
 failed: