]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Fix driver initialization not to crash if driver does not use init2()
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 2 Dec 2009 14:43:09 +0000 (16:43 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 2 Dec 2009 14:43:09 +0000 (16:43 +0200)
8a5ab9f5e56cd2f5781c2d92f41495e60d544780 fixed global driver context
for init2(), but it also broke driver initialization with driver
wrappers that do not use init2().. Fix this by setting wpa_s->global
before it gets dereferenced.

wpa_supplicant/wpa_supplicant.c

index d58e55b7a8631006fc667608f0d14d7d4c80b08b..dec408ee4a339e3fe2d760ebb9bde918cb87c341 100644 (file)
@@ -2166,6 +2166,8 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
        if (wpa_s == NULL)
                return NULL;
 
+       wpa_s->global = global;
+
        t_iface = *iface;
        if (global->params.override_driver) {
                wpa_printf(MSG_DEBUG, "Override interface parameter: driver "
@@ -2189,8 +2191,6 @@ struct wpa_supplicant * wpa_supplicant_add_iface(struct wpa_global *global,
                return NULL;
        }
 
-       wpa_s->global = global;
-
        /* Notify the control interfaces about new iface */
        if (wpas_notify_iface_added(wpa_s)) {
                wpa_supplicant_deinit_iface(wpa_s);