]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix group idle timer cancellation on group removal
authorJouni Malinen <jouni@qca.qualcomm.com>
Sun, 19 Feb 2012 16:10:20 +0000 (18:10 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 19 Feb 2012 16:10:20 +0000 (18:10 +0200)
The wpas_p2p_group_idle_timeout was getting cancelled in the beginning
of wpas_p2p_group_delete(). However, in the case of P2P client role,
this function called wpa_supplicant_deauthenticate() next and that ended
up changing state to WPA_DISCONNECTED which resulted in
wpas_p2p_notif_disconnected() rescheduling the timeout. This left the
unexpected timeout behind after the group was removed. If another group
operation was started within P2P_MAX_CLIENT_IDLE (10) seconds, that
timeout could end up terminating the group while it was still being set
up.

Fix this by reordering wpas_p2p_group_delete() to cancel the group idle
timeout only after having called wpa_supplicant_deauthenticate(). The
group idle timeout is still rescheduled, but it gets removed immediately
afterwards when the actual group information is being cleared.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

wpa_supplicant/p2p_supplicant.c

index 015e6b41c45932952c68536bb11750507e562a04..121f6026637e68f8b3124850239a55e7183b7284 100644 (file)
@@ -213,8 +213,6 @@ static void wpas_p2p_group_delete(struct wpa_supplicant *wpa_s)
        char *gtype;
        const char *reason;
 
-       eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
-
        ssid = wpa_s->current_ssid;
        if (ssid == NULL) {
                /*
@@ -264,6 +262,8 @@ static void wpas_p2p_group_delete(struct wpa_supplicant *wpa_s)
        wpa_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_REMOVED "%s %s%s",
                wpa_s->ifname, gtype, reason);
 
+       eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
+
        if (ssid)
                wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);