From e83e15ee771988c57b73cb4badf728aaf0943291 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 15 Apr 2014 00:20:17 +0300 Subject: [PATCH] P2P: Fix interface remove to terminate all P2P groups 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 --- wpa_supplicant/wpa_supplicant.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index a9fbf007b..7285bec4b 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -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");