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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2012-02-09 12:49:36 +02:00 committed by Jouni Malinen
parent 165ec73053
commit 59acfe87aa

View file

@ -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;
}