]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Fix P2P_FIND while waiting for listen ROC to start in the driver
authorJouni Malinen <jouni@qca.qualcomm.com>
Wed, 30 Dec 2015 22:35:21 +0000 (00:35 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 30 Dec 2015 22:35:21 +0000 (00:35 +0200)
It was possible for the p2p->pending_listen_freq to be left indicating
that there is a pending ROC for a listen operation if a P2P_FIND command
was timed to arrive suitably between a previous Listen operation issuing
a ROC request and the kernel code starting that request. This could
result in the P2P state machine getting stuck unable to continue the
find ("P2P: p2p_listen command pending already").

Fix this by clearing p2p->pending_listen_freq when starting P2P_FIND
command execution.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/p2p/p2p.c

index 50b89333f37f047f7ba4b1c176af5be78b88be42..d6d46ebd15feb7a47cb46e50381abd94297e6068 100644 (file)
@@ -1221,6 +1221,10 @@ int p2p_find(struct p2p_data *p2p, unsigned int timeout,
 
        p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING;
        p2p_clear_timeout(p2p);
+       if (p2p->pending_listen_freq) {
+               p2p_dbg(p2p, "Clear pending_listen_freq for p2p_find");
+               p2p->pending_listen_freq = 0;
+       }
        p2p->cfg->stop_listen(p2p->cfg->cb_ctx);
        p2p->find_type = type;
        p2p_device_clear_reported(p2p);