From 78a3b230606d4b2637fb69d88f77a80562ebe651 Mon Sep 17 00:00:00 2001 From: Avrahams Stern Date: Tue, 18 Oct 2016 12:44:16 +0300 Subject: [PATCH] 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 --- src/p2p/p2p.c | 1 + src/p2p/p2p_pd.c | 3 +++ 2 files changed, 4 insertions(+) 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: