[PATCH 1/1] P2P: Avoid resetting pending_listen_freq, if p2p_listen is pending

Jithu Jance jithu at broadcom.com
Wed May 7 04:32:06 EDT 2014

If p2p_listen is called while previous listen command's
remain_on_channel event is pending, the p2p_listen would fail
and it used to clear pending_listen_freq. Now when the remain-
on-channel event comes from the driver, the pending_listen_freq
doesn't match and gets ignored. This was leading to a case
where listen state was getting stuck (in case of WAIT_PEER_CONNECT

Signed-hostap: Jithu Jance <jithu at broadcom.com>
 src/p2p/p2p.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index b30ea56..3efc071 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -284,6 +284,12 @@ int p2p_listen(struct p2p_data *p2p, unsigned int timeout)

 	p2p_dbg(p2p, "Going to listen(only) state");

+	if (p2p->pending_listen_freq) {
+		/* We have a pending p2p_listen request */
+		p2p_dbg(p2p, "p2p_listen command pending already");
+		return -1;
+	}
 	freq = p2p_channel_to_freq(p2p->cfg->reg_class, p2p->cfg->channel);
 	if (freq < 0) {
 		p2p_dbg(p2p, "Unknown regulatory class/channel");

More information about the HostAP mailing list