[PATCH] P2P: clear pending_listen_freq when listening is done

Michael Olbrich m.olbrich at pengutronix.de
Thu Mar 23 01:18:52 PDT 2023

Usually pending_listen_freq is cleared in p2p_listen_cb() which is called
the REMAIN_ON_CHANNEL event. So when p2p_listen_end() is called for the
following CANCEL_REMAIN_ON_CHANNEL event then pending_listen_freq is
already zero.
However, with some errors only a CANCEL_REMAIN_ON_CHANNEL is generated and
pending_listen_freq is never cleared. As a result, listening is never
started again.

Clear pending_listen_freq in p2p_listen_end() to avoid this.

Signed-off-by: Michael Olbrich <m.olbrich at pengutronix.de>
 src/p2p/p2p.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 39af1b9bb0e9..7f782d70db48 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -3883,6 +3883,7 @@ void p2p_listen_cb(struct p2p_data *p2p, unsigned int freq,
 int p2p_listen_end(struct p2p_data *p2p, unsigned int freq)
 	p2p_dbg(p2p, "Driver ended Listen state (freq=%u)", freq);
+	p2p->pending_listen_freq = 0;
 	p2p->drv_in_listen = 0;
 	if (p2p->in_listen)
 		return 0; /* Internal timeout will trigger the next step */

More information about the Hostap mailing list