]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Verify that global driver pointer is not NULL
authorJouni Malinen <j@w1.fi>
Sun, 13 Nov 2011 20:39:57 +0000 (22:39 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 13 Nov 2011 20:39:57 +0000 (22:39 +0200)
driver_nl80211.c assumes that global driver pointer is set, so better
make this more consistent.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/drivers/driver_nl80211.c

index 2ab10aef1a1341956e542aba74b16d7c0060de78..0f7447b059b6b756c8b8f26f9d2c1e8a99d35530 100644 (file)
@@ -2278,6 +2278,8 @@ static void * wpa_driver_nl80211_init(void *ctx, const char *ifname,
        struct rfkill_config *rcfg;
        struct i802_bss *bss;
 
+       if (global_priv == NULL)
+               return NULL;
        drv = os_zalloc(sizeof(*drv));
        if (drv == NULL)
                return NULL;
@@ -2452,8 +2454,7 @@ wpa_driver_nl80211_finish_drv_init(struct wpa_driver_nl80211_data *drv)
         * dynamically added interface (e.g., P2P) that was already configured
         * with proper iftype.
         */
-       if ((drv->global == NULL ||
-            drv->ifindex != drv->global->if_add_ifindex) &&
+       if (drv->ifindex != drv->global->if_add_ifindex &&
            wpa_driver_nl80211_set_mode(bss, NL80211_IFTYPE_STATION) < 0) {
                wpa_printf(MSG_ERROR, "nl80211: Could not configure driver to "
                           "use managed mode");