From nobody Mon May 25 04:35:35 2026 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14EB137EFFB; Mon, 18 May 2026 17:02:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779123736; cv=none; b=UJwQHLG5dvL03XwAD5mmeKZRh9TVA7mvjNnvt2xB5abhEqsRd2Mlsh15YgP5HjsJOjMghJlb4faqChHqk2PeZjkecpHg+FhoeDuSqMWfurQ+HVFPBi9H57FzxCP5ntsk1hOauqpSVFejhSy2lwFoQPaQZnfPrjrsgBYUpXalER4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779123736; c=relaxed/simple; bh=HTVC/uQlc3+FyQxEwauI5xzA8o6CsaZzTi+fW37idnY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iLkxs66HUT/kYcJPmNVwMWc5GmcxSZm5HJEKTSe8lvV2ExsMsFSyTOhwcfIssfwnlzEU8Mc1arnk7fORSEmkqq1q0lXeGIaltyWYnjy0jiliVT3v+v1WckRpaJ38O5my07YpGp23oNm4REEqmKJ1E8uXF0gpDWRBHSHqS+TTd2w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=justthetip.ca; spf=pass smtp.mailfrom=justthetip.ca; dkim=pass (2048-bit key) header.d=justthetip.ca header.i=@justthetip.ca header.b=HCGvVc/d; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=justthetip.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=justthetip.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=justthetip.ca header.i=@justthetip.ca header.b="HCGvVc/d" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=justthetip.ca; s=key1; t=1779123731; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ESnfBt7T8rmVjr1iPiYQF7zF6vpA6x++Cs8prC+X9Ng=; b=HCGvVc/drxd0YUoh8KQzqiACoSkWjvy7ila2F4/+V32iI+R6K+RZXYKkT2lipsT+n2jf+c 6wxiQtH7IaAO9ixEEKqQAWXFR1RUFMHCswgjx7lTVvvRUgjOsVcPNW/YKYIZhPbQbpwtdZ fZgDekBY+1YSGsAP+DCZ5UPMLY5N/lltjAduXm/xB3qwPlQUEILbEzLak6VMRhXplgu82X B6q3QiTPbRcTc5TokP61KQRXL2eNCqDNY0FKylnpkJx1OdKr7WvdbbX9zgVFx+JtIBCCQl e23jAKYUnH/2O8M6t32sifwVJr/hpmAvnZYCibh1XqDTUJvp0GqtKtvwn2liCA== From: Devin Wittmayer To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Felix Fietkau , Lorenzo Bianconi , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Oscar Alfonso Diaz , fjhhz1997@gmail.com, Devin Wittmayer Subject: [PATCH v3] wifi: mac80211: fix monitor mode frame capture for real chanctx drivers Date: Mon, 18 May 2026 10:01:47 -0700 Message-ID: <20260518170147.13885-2-lucid_duck@justthetip.ca> In-Reply-To: <20260518170147.13885-1-lucid_duck@justthetip.ca> References: <20260308164510.5927-1-fjhhz1997@gmail.com> <20260518170147.13885-1-lucid_duck@justthetip.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT From: =E5=82=85=E7=BB=A7=E6=99=97 Commit d594cc6f2c58 ("wifi: mac80211: restore non-chanctx injection behaviour") restored the monitor injection fallback for drivers using chanctx emulation but explicitly deferred the harder case of drivers that transitioned to real chanctx ops. mt76 falls in that category and still drops every injected frame when monitor coexists with another interface. When the monitor has no chanctx of its own, fall back to the only chanctx in flight if there is exactly one. Refuse if multiple are present: picking arbitrarily would inject onto an unrelated channel. Reran the airgeddon evil-twin flow (hostapd AP + coexisting monitor VIF on the same phy + aireplay-ng deauth from the monitor) on mt7921e PCIe and mt7921u USB across 2.4 GHz and 5 GHz, and on a Kali VM with MT7921U passthrough as the closest match to the original reporter's setup. None reproduced the hang seen against the earlier attempt at this fix (<20251216111909.25076-2-johannes@sipsolutions.net>) or against v1 on lore in March. Cc: stable@vger.kernel.org # 6.9+ Reported-by: Oscar Alfonso Diaz Closes: https://github.com/morrownr/USB-WiFi/issues/682 Tested-by: Devin Wittmayer Fixes: 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers") Signed-off-by: =E5=82=85=E7=BB=A7=E6=99=97 Signed-off-by: Devin Wittmayer --- v3: - Replace list_is_singular() + list_first_entry() with list_first_or_null_rcu() and an rcu_access_pointer() check that the entry is the only one in the list. The v2 pair re-read ->next without RCU between the singularity check and the entry fetch, racing list_del_rcu() of the sole entry (rculist.h). - Tested-by carries from v2: v3 changes the lookup primitive only, not the TX path, so the v2 airgeddon evil-twin flow on mt7921e/mt7921u/Kali-VM still applies. v2: - First respin under my submitter signoff; preserves fjh1997 authorship. - Verification matrix; airgeddon evil-twin flow on mt7921e/ mt7921u/Kali-VM does not reproduce the hang reported against the v1 attempt at this fix. net/mac80211/tx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 933c86ca21c3..6d2c71a13f26 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2407,12 +2407,20 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_= buff *skb, rcu_dereference(tmp_sdata->vif.bss_conf.chanctx_conf); } =20 - if (chanctx_conf) + if (chanctx_conf) { chandef =3D &chanctx_conf->def; - else if (local->emulate_chanctx) + } else if (local->emulate_chanctx) { chandef =3D &local->hw.conf.chandef; - else - goto fail_rcu; + } else { + struct ieee80211_chanctx *ctx; + + ctx =3D list_first_or_null_rcu(&local->chanctx_list, + struct ieee80211_chanctx, list); + if (!ctx || + rcu_access_pointer(ctx->list.next) !=3D &local->chanctx_list) + goto fail_rcu; + chandef =3D &ctx->conf.def; + } =20 /* * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still