From patchwork Wed May 7 08:32:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jithu Jance X-Patchwork-Id: 346428 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 5622B14030A for ; Wed, 7 May 2014 18:32:36 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BFE329D203; Wed, 7 May 2014 04:32:32 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5v1gqquAsfrt; Wed, 7 May 2014 04:32:32 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 16CB29D204; Wed, 7 May 2014 04:32:27 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 46B609D204 for ; Wed, 7 May 2014 04:32:25 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wzp7E2eGkxlO for ; Wed, 7 May 2014 04:32:18 -0400 (EDT) Received: from mail-gw2-out.broadcom.com (mail-gw2-out.broadcom.com [216.31.210.63]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 772649D203 for ; Wed, 7 May 2014 04:32:18 -0400 (EDT) X-IronPort-AV: E=Sophos;i="4.97,1001,1389772800"; d="scan'208";a="28144414" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw2-out.broadcom.com with ESMTP; 07 May 2014 01:58:39 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Wed, 7 May 2014 01:32:17 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Wed, 7 May 2014 01:32:17 -0700 Received: from jithu?broadcom.com (lbblr-jithu01.ban.broadcom.com [10.132.24.37]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id B282E51E9A for ; Wed, 7 May 2014 01:32:11 -0700 (PDT) Date: Wed, 7 May 2014 14:02:06 +0530 From: Jithu Jance To: Subject: [PATCH 1/1] P2P: Avoid resetting pending_listen_freq, if p2p_listen is pending Message-ID: MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com 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). Signed-hostap: Jithu Jance --- src/p2p/p2p.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 1.7.9.5 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");