]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Avoid re-starting p2p_search in some corner cases
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 9 Feb 2012 10:49:36 +0000 (12:49 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 9 Feb 2012 10:49:36 +0000 (12:49 +0200)
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>

src/p2p/p2p.c

index 82932aae72b0384d7d9e1bb6fb5bbeec6664a5f7..26cef01499b20a2c120365d0f0f1e1ecc3a08ac8 100644 (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;
        }