P2P: Fix interface remove to terminate all P2P groups
authorJouni Malinen <j@w1.fi>
Mon, 14 Apr 2014 21:20:17 +0000 (00:20 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 14 Apr 2014 21:20:17 +0000 (00:20 +0300)
Previously, it was possible to remove the main interface and leave
behind dynamic P2P group interfaces. This would eventually result in
references freed memory, so it is not really suitable behavior. Instesd,
remove all the dynamic P2P group interfaces that were created through an
interface that is now removed.

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

index a9fbf00..7285bec 100644 (file)
@@ -3679,6 +3679,8 @@ static void wpa_supplicant_deinit_iface(struct wpa_supplicant *wpa_s,
        wpa_supplicant_cleanup(wpa_s);
 
 #ifdef CONFIG_P2P
+       if (wpa_s == wpa_s->parent)
+               wpas_p2p_group_remove(wpa_s, "*");
        if (wpa_s == wpa_s->global->p2p_init_wpa_s && wpa_s->global->p2p) {
                wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Disable P2P since removing "
                        "the management interface is being removed");