From patchwork Thu Aug 27 17:13:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arowa Suliman X-Patchwork-Id: 2293593 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=pISSVIGB; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DwMsSlz9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4hW7Sr2Cngz1xtd for ; Fri, 28 Aug 2026 03:15:40 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A1ZQIMLjb6kC4Jmxt8kGOWwo7zh8lykI6UStmDzHKkw=; b=pISSVIGB4C54jZ SJlzx4FxhbxkzL/yfhfN3iq+Xf6C35HNf1w2kwGP1WWn9aGl+lQZl/vExXuJbcrh0jpYEC3bxWjqB oVpHj0xjueC1fl2z5JwgdlJ9JBj0TkaM1ejHL28eQ8yzG0/4YOGsjcJ9VJYutVpSqGEalOWeKPVMY Mt45GA2CRQ1eoIsV9V7jcvPq3DgKoxdZ3XkVHhqCpPjbpTqBa8qWtb0BJo18PI0Ap4eEyQNyIDsIa S/h/ouc/sTrPLdNxIX7K0sfBR+/HjJaii8848WTsWPuzveHIfByITeVBAkC9hwGD8mXEGzCpasyUm yqAN/K4p+zaix8alVM6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wzdfr-00000004R0o-3OMs; Thu, 27 Aug 2026 17:13:59 +0000 Received: from mail-ot1-x330.google.com ([2607:f8b0:4864:20::330]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wzdfp-00000004R0G-1kOG for hostap@lists.infradead.org; Thu, 27 Aug 2026 17:13:58 +0000 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-7f3ff92cf4aso180930a34.1 for ; Thu, 27 Aug 2026 10:13:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1787850835; x=1788455635; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=3JNtwO5vMiUL1au3ylfMlORtXLAJ9kCIcUrlxAs+JbI=; b=DwMsSlz9S+sO4or76XlpV/uxmSCf7xxoHgnRLCqatJXb/V19EkIc7X7BnnOQYn6oPI DQOc8NLKQUYa9UY0wP0bkEaRpUskMKcNq2tpUrT2/4KGKU4cAnjr9To5+MkQ92p3RlZV q9mSYdKnMVWE4HucWWaHExGbdUCXYvsg9d3NM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787850835; x=1788455635; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=3JNtwO5vMiUL1au3ylfMlORtXLAJ9kCIcUrlxAs+JbI=; b=I4hGxFruSIvrFsmVwqTj+5n2DdrJOGk8a8JSeUWiHgdhri40nNlDnyQUwLRigAq6QN IY+EfT26euyDME2UyWuDJz8JNY7l2kPZdrKpuTE8R9hQJ+HHbGHY3E74zK/xj+EZn1tx V9wBS4d905J5KDQFyEFKNySFcvgQjbTj4XekR0pWXGbzLdhXaja5A5gEhHIh3TZ+Ljcm M0Rgb7SggX+qWm4FU50qiYEuSIOAWXOc9lLzjMvWUgpxIYUttwfy6/aYB1cNNno/i3iM 3ipqzjoVNNSWa9pfW2JLGW2rQl6dg2N7xwxB7g9E152XOARj+V4/cT1Y0/cWdZovAW1l I9AA== X-Gm-Message-State: AFuF++nIWMZ4xQPsf1F15l4rQULfoECAIWi8yI8rfKXoOITpXpRx2QQJ YwwqTExHaMR53WHr9MmGb2ZLMckjfx9Alne0tuEylnW6l+Dg/MHhE2kgQiamrANiHoEmY4dvunm 5iV0= X-Gm-Gg: AR+sD10IXBtPHUK/Utnytysh3KY33I5r8kxfzz2pPmHvW4RNnSY8ZtREvI9DpxbMv1H fdbw9N5D1WlG62YMZYlPqM3TtNpwGDGz0gJ0sMidJaR3+LljdeQeh8mXnwtPU20RJM58bAkVupg csUMP8OB3nB+cSRotTG+VzEm+mHsKkdatHBtq0wnkXRO/BnjsZ3iIjOl3SCELj41mJwi9sciJJc upFHHiVdSyP5g+TTIbv7spUcARAaMarYlR9fwpHGubecgMSgctyQhf/QSdTlxki0SmjD/4xCs3o so4ndjmSRoLvDGoWdOvh8bdyF2tA0X54bpsLjLMMT2rU0BUWOvVEjp6mqL93q4Kji+XG4ilzoVi 0tdIHfQQRyweCblU3SWY0lqhJy4FxQqCycvN5PD93zJX0cud/9DqrCDNZdo8Y1hWvsjc1WLMFG/ nidip7KzNiqiVEfrhkIbQ9r3WJMvtHSbx11mFTFNQsvw3YbQtSMg+yO698p2e6kREy3oxKdqwAG BW9I2VRmP92R4bzT7p15pqmRx1Wbv4DwqEnU9YMMrJHWZDRNA== X-Received: by 2002:a05:6830:3108:b0:7f3:ff22:d8 with SMTP id 46e09a7af769-7f4f23493f5mr963055a34.9.1787850835219; Thu, 27 Aug 2026 10:13:55 -0700 (PDT) Received: from arowa.c.googlers.com.com (119.222.198.104.bc.googleusercontent.com. [104.198.222.119]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7f4c842bb67sm4531038a34.18.2026.08.27.10.13.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2026 10:13:54 -0700 (PDT) From: Arowa Suliman To: hostap@lists.infradead.org Cc: Jouni Malinen , Arowa Suliman Subject: [PATCH v2] P2P: Clear pending_listen_freq when radio work is cancelled Date: Thu, 27 Aug 2026 17:13:52 +0000 Message-ID: <20260827171352.494035-1-arowa@chromium.org> X-Mailer: git-send-email 2.55.0.897.gb25b4bd76c-goog In-Reply-To: <20260824220241.1876961-1-arowa@chromium.org> References: <20260824220241.1876961-1-arowa@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260827_101357_492198_C3A735D1 X-CRM114-Status: GOOD ( 12.51 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: When a P2P listen radio work is deinitialized before starting (e.g., preempted by a scan or stopped during provision discovery), pending_listen_freq was not cleared in wpa_supplicant and the P2P core. [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:330 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 DKIMWL_WL_HIGH DKIMwl.org - High trust sender -0.0 DMARC_PASS DMARC pass policy X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org When a P2P listen radio work is deinitialized before starting (e.g., preempted by a scan or stopped during provision discovery), pending_listen_freq was not cleared in wpa_supplicant and the P2P core. This left the state machine with a pending listen state, causing subsequent listen operations to be rejected and stalling the event loop. Fix this by: 1. Clearing pending_listen_freq and notifying the P2P core in wpas_start_listen_cb() on deinit and in wpas_stop_listen(). 2. Adding p2p_cancel_pending_listen() helper to clear pending_listen_freq and pending_listen_wait_drv in struct p2p_data. Signed-off-by: Arowa Suliman --- src/p2p/p2p.c | 13 +++++++++++++ src/p2p/p2p.h | 1 + wpa_supplicant/p2p_supplicant.c | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 09ed2fe0f..ba1148a38 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -1418,6 +1418,19 @@ void p2p_stop_listen(struct p2p_data *p2p) } +void p2p_cancel_pending_listen(struct p2p_data *p2p) +{ + if (p2p) { + if (p2p->pending_listen_freq) { + p2p_dbg(p2p, "Clear pending_listen_freq (%u) for p2p_cancel_pending_listen", + p2p->pending_listen_freq); + p2p->pending_listen_freq = 0; + } + p2p->pending_listen_wait_drv = false; + } +} + + void p2p_stop_find(struct p2p_data *p2p) { p2p->pending_listen_freq = 0; diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 7c89c8c35..0d1b81a18 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1606,6 +1606,7 @@ int p2p_listen(struct p2p_data *p2p, unsigned int timeout); * @p2p: P2P module context from p2p_init() */ void p2p_stop_listen(struct p2p_data *p2p); +void p2p_cancel_pending_listen(struct p2p_data *p2p); /** * p2p_connect - Start P2P group formation (GO negotiation) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index e5d4afe3c..f9d893528 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3235,6 +3235,9 @@ static void wpas_start_listen_cb(struct wpa_radio_work *work, int deinit) unsigned int duration; if (deinit) { + wpa_s->pending_listen_freq = 0; + if (wpa_s->global->p2p) + p2p_cancel_pending_listen(wpa_s->global->p2p); if (work->started && !wpa_s->p2p_removing_listen_work) wpas_stop_started_listen_work(work); wpas_p2p_listen_work_free(lwork); @@ -3341,6 +3344,9 @@ static void wpas_stop_listen(void *ctx) radio_remove_works(wpa_s, "p2p-listen", 0); wpa_s->p2p_removing_listen_work = false; } + wpa_s->pending_listen_freq = 0; + if (wpa_s->global->p2p) + p2p_cancel_pending_listen(wpa_s->global->p2p); }