From: Avrahams Stern Date: Tue, 18 Oct 2016 09:44:16 +0000 (+0300) Subject: P2P: Clear old P2PS provision data X-Git-Tag: hostap_2_7~2160 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=78a3b230606d4b2637fb69d88f77a80562ebe651;p=thirdparty%2Fhostap.git P2P: Clear old P2PS provision data Receiving a provision discovery request for an ASP service that has auto accept set to false should result in a provision discovery response with the status field set to "currently unavailable". Having stale P2PS provision data, results in sending a response with the status set to success because it is mistakenly referred to as the follow-on provision discovery request. Fix that by clearing stale P2PS provision data in the following cases: 1. When provision discovery is complete 2. When ASP services are flushed (in which case old ASP provisioning is no longer valid). Signed-off-by: Avrahams Stern --- diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index cdf6d9915..cd2fba334 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -2822,6 +2822,7 @@ void p2p_service_flush_asp(struct p2p_data *p2p) } p2p->p2ps_adv_list = NULL; + p2ps_prov_free(p2p); p2p_dbg(p2p, "All ASP advertisements flushed"); } diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index 54b2ab425..3994ec03f 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -1163,6 +1163,9 @@ out: msg.group_id, msg.group_id_len); } + if (reject != P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE) + p2ps_prov_free(p2p); + if (reject == P2P_SC_SUCCESS) { switch (config_methods) { case WPS_CONFIG_DISPLAY: