nl80211: Do not add interface to the global list in case of failure

This avoids leaving a freed interface on the global list in case
driver initialization fails.
This commit is contained in:
Johannes Berg 2011-03-22 15:52:04 +02:00 committed by Jouni Malinen
parent cd9fc7869a
commit c4bb881743

View 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: