From e79eb0c6602ae315b33cc7f4aa3cf7c296464a38 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 31 Dec 2015 00:35:21 +0200 Subject: [PATCH] P2P: Fix P2P_FIND while waiting for listen ROC to start in the driver 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 --- src/p2p/p2p.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 50b89333f..d6d46ebd1 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -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);