From 77dfafd07d3a0335e250b8ffaf74fe7b3714b0bc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 10 Feb 2013 23:36:52 +0200 Subject: [PATCH] P2P: Cancel group formation timeout on group removal (on client) Group formation timeout is normally canceled when 4-way handshake is completed (WPA_COMPLETED -> wpas_p2p_completed). However, it is possible for the GO to stop the group before this happens (i.e., send Deauthentication frame with reason code 3 before 4-way handshake is completed). This resulted in the group getting removed, but the group formation timeout left behind. The unexpected timeout may then result in undesired termination of the following operation. Fix this by canceling the group formation timeout in wpas_p2p_group_delete() similarly to how group idle timeout was canceled there. Signed-hostap: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 53c900908..21f5cf646 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -86,6 +86,8 @@ static int wpas_p2p_create_iface(struct wpa_supplicant *wpa_s); static void wpas_p2p_cross_connect_setup(struct wpa_supplicant *wpa_s); static void wpas_p2p_group_idle_timeout(void *eloop_ctx, void *timeout_ctx); static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s); +static void wpas_p2p_group_formation_timeout(void *eloop_ctx, + void *timeout_ctx); static void wpas_p2p_fallback_to_go_neg(struct wpa_supplicant *wpa_s, int group_added); static int wpas_p2p_stop_find_oper(struct wpa_supplicant *wpa_s); @@ -316,6 +318,10 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s, if (eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL) > 0) wpa_printf(MSG_DEBUG, "P2P: Cancelled P2P group idle timeout"); + if (eloop_cancel_timeout(wpas_p2p_group_formation_timeout, + wpa_s->parent, NULL) > 0) + wpa_printf(MSG_DEBUG, "P2P: Cancelled P2P group formation " + "timeout"); if (removal_reason != P2P_GROUP_REMOVAL_SILENT && ssid) wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);