diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index cd71a244c..ed9f81aaa 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -929,6 +929,16 @@ void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq) "since we are on correct channel for response"); return; } + if (p2p->drv_in_listen) { + /* + * The driver may not deliver callback to p2p_listen_end() + * when the operation gets canceled, so clear the internal + * variable that is tracking driver state. + */ + wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Clear " + "drv_in_listen (%d)", p2p->drv_in_listen); + p2p->drv_in_listen = 0; + } p2p->cfg->stop_listen(p2p->cfg->cb_ctx); }