P2P: Fix group idle timer cancellation on group removal

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>
This commit is contained in:
Jouni Malinen 2012-02-19 18:10:20 +02:00 committed by Jouni Malinen
parent 2c60ca7391
commit a7a30b90e5

View file

@ -213,8 +213,6 @@ static void wpas_p2p_group_delete(struct wpa_supplicant *wpa_s)
char *gtype; char *gtype;
const char *reason; const char *reason;
eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
ssid = wpa_s->current_ssid; ssid = wpa_s->current_ssid;
if (ssid == NULL) { 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_msg(wpa_s->parent, MSG_INFO, P2P_EVENT_GROUP_REMOVED "%s %s%s",
wpa_s->ifname, gtype, reason); wpa_s->ifname, gtype, reason);
eloop_cancel_timeout(wpas_p2p_group_idle_timeout, wpa_s, NULL);
if (ssid) if (ssid)
wpas_notify_p2p_group_removed(wpa_s, ssid, gtype); wpas_notify_p2p_group_removed(wpa_s, ssid, gtype);