From 59acfe87aad300ae74e0233d62fa830179d00884 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 9 Feb 2012 12:49:36 +0200 Subject: [PATCH] P2P: Avoid re-starting p2p_search in some corner cases Search (p2p_scan) could already have been started at the point remain-on-channel end event is being processed, e.g., if an Action frame TX is reported immediately aftet the end of an earlier remain-on-channel operation and the response frame is sent using an offchannel operation while p2p_find is still in progress. Avoid trying to re-run p2p_scan while the previous one is still running. Signed-hostap: Jouni Malinen --- src/p2p/p2p.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 82932aae7..26cef0149 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -2851,6 +2851,20 @@ int p2p_listen_end(struct p2p_data *p2p, unsigned int freq) p2p_connect_send(p2p, p2p->go_neg_peer); return 1; } else if (p2p->state == P2P_SEARCH) { + if (p2p->p2p_scan_running) { + /* + * Search is already in progress. This can happen if + * an Action frame RX is reported immediately after + * the end of a remain-on-channel operation and the + * response frame to that is sent using an offchannel + * operation while in p2p_find. Avoid an attempt to + * restart a scan here. + */ + wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: p2p_scan " + "already in progress - do not try to start a " + "new one"); + return 1; + } p2p_search(p2p); return 1; }