]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mesh: Fix mesh interface removal fix
authorJouni Malinen <j@w1.fi>
Sat, 4 Feb 2017 19:24:37 +0000 (21:24 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 4 Feb 2017 19:24:37 +0000 (21:24 +0200)
This wpa_drv_if_remove() call was previously modified to fix a different
issue, but that fix resulted in unconditional use of treed memory here
(wpa_supplicant_deinit_iface() frees wpa_s). Make a local copy of
wpa_s->parent to be able to use it after wpa_s is freed. The
mesh_if_created case has wpa_s->parent != wpa_s, so this should be
sufficient way of handling the wpa_drv_if_remove() call here.

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/wpa_supplicant.c

index 742aa1f0b9bd342558805ea846738283beb88231..448a592710115ca0d331ec929431c081a6ea134d 100644 (file)
@@ -5322,6 +5322,7 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
 #ifdef CONFIG_MESH
        unsigned int mesh_if_created = wpa_s->mesh_if_created;
        char *ifname = NULL;
+       struct wpa_supplicant *parent = wpa_s->parent;
 #endif /* CONFIG_MESH */
 
        /* Remove interface from the global list of interfaces */
@@ -5357,7 +5358,7 @@ int wpa_supplicant_remove_iface(struct wpa_global *global,
 
 #ifdef CONFIG_MESH
        if (mesh_if_created) {
-               wpa_drv_if_remove(wpa_s->parent, WPA_IF_MESH, ifname);
+               wpa_drv_if_remove(parent, WPA_IF_MESH, ifname);
                os_free(ifname);
        }
 #endif /* CONFIG_MESH */