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

Jouni Malinen j
Sun May 11 12:49:28 PDT 2014

On Wed, May 07, 2014 at 02:02:06PM +0530, Jithu Jance wrote:
> 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
> state).

> diff --git 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;
> +	}

This seems to be causing failures in hwsim test cases. I'm not
completely sure why, but the logs seems to imply that this case is hit
and the P2P state machine is then stuck in waiting for something that
never happens. It looks like this can happen at least when P2P_LISTEN is
issued while a p2p_scan from a previously started P2P_FIND is in

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list