From 618aa229002ab386c4acdfb0a43e141baa21a2d5 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Tue, 13 Jun 2017 14:45:49 +0300 Subject: [PATCH] P2P: Fix p2p_in_provisioning clearing in failure case wpa_s->p2p_in_provisioning needs to be cleared when group formation fully completes. The change to postpone GO side handling to the first data connection in commit 41f853235fe1d1fad1acecc0ee5dfe81c872c6b2 ('P2P: Extend group formation timeout on GO to first data connection') resulted in making this not happen in one P2P Client side case: EAP-WSC timeout in PBC case. While that is quite special case since it requires 30 second timeout without receiving new EAPOL frames and not getting disassociation, it can apparently happen in some cases in practice. This would result in new P2P operations (e.g., P2P_FIND) getting rejected until wpa_supplicant is restarted. Fix this by clearing wpa_s->p2p_in_provisioning whenever processing a group formation failure case. For group formation success, wpa_s->p2p_in_provisioning is left set to non-zero value to avoid breaking the earlier limits on the GO side. Signed-off-by: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 413e4e00b..578d9901a 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -1320,6 +1320,10 @@ static void wpas_group_formation_completed(struct wpa_supplicant *wpa_s, if (wpa_s->p2p_go_group_formation_completed) { wpa_s->global->p2p_group_formation = NULL; wpa_s->p2p_in_provisioning = 0; + } else if (wpa_s->p2p_in_provisioning && !success) { + wpa_msg(wpa_s, MSG_DEBUG, + "P2P: Stop provisioning state due to failure"); + wpa_s->p2p_in_provisioning = 0; } wpa_s->p2p_in_invitation = 0; wpa_s->group_formation_reported = 1;