From nobody Thu Apr 9 13:31:45 2026 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F54630FF1D for ; Sun, 8 Mar 2026 16:45:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988329; cv=none; b=OGvc8IelJd9USF0FmI8MiiozN/KkfFbWr3928vXPoDJkLPFHDJjAfsMBIuv1Ym3rGu3Hz2UnB97ADPOO58jq4HbkbmpNTjccZ1DI/PuwKpz1Js07XYuGVnoJPvVY7Ml/s/ED837fFEl6vGi5dyJXS10lyG2H1lZfm7npZIZvWJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772988329; c=relaxed/simple; bh=3ZsMukaIBQF8clZEQgBlk3fbZVydnmjSCHhfvXHBBzw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tmN4wcAaoXsfRPIiRZIglRMNwHpHHhXNZQ4G/bM7dfkevyGA2Cmpij6uagcJY7p1s9Q6I47L6FHuVFttYtbk8ngmc8pRpkCw48DcTRheUSNIX4ODKSaqGDtrxwoCdsN4uxaoufUYfAg11neJt5Qt1H++Cz675d9XZhZ3IGKqI8g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=flrF4yNa; arc=none smtp.client-ip=209.85.216.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="flrF4yNa" Received: by mail-pj1-f52.google.com with SMTP id 98e67ed59e1d1-3597b474cbdso4440816a91.1 for ; Sun, 08 Mar 2026 09:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772988326; x=1773593126; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cSyQyBckY6yDa/40OyCVuQtNFVPo/rjnkS7c5eUMd0A=; b=flrF4yNaol2fc3hCgZhuzXrD2oED35/tBD7lf+Hl2XV0Ru4a9n0KjpZ5Rs5WozdQPo RTrUY4i5YosfJQzQdNgy/T6ZG+MCyLiE20blOtS7PySl5Iq8ZgDgXSnnRVSWrinXt6EY th4QmHamBW+AgUwQBcAEsCQ0JyC0Cgmb1DVUslgHfrTP+3RjRsuOg6GvaKA3mMTaDy8k WAvEizK7ltI7sKbuId4q734cVDWOX7Wh6FzWAzd7gXxg+7OCIj1Xz4sVOYQ2sFi34MsB murDuMa4HCXzGN2uiQCou7kWWjSrggk76lYPYhfSpSwVSd4d96sWJm3nVIm/Lttap/l5 GnLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772988326; x=1773593126; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cSyQyBckY6yDa/40OyCVuQtNFVPo/rjnkS7c5eUMd0A=; b=AuPVxqHJpzsDYbMTRvfCiV4G6m2FCMbJEW5ZlfaSNkO4dUsYPWnrReJN/zMWVWBe53 q4FM8O6SPa5hshQQVFRYrrXXgdhoP8J79EdiDuKniLn2iy8LALU8xOvLb0NTVW50gDlr xGerPhVfQxPVy9OC+Dks47mcgORXAFTzwt04iM9UBmcvcF9A0sdhm1DjXH+Di+b3ustz quDgoWIskku9O5TsABod15Vc3s5K4xs2BAdKpNT+jjMYuhRBIkDWQ9HcGPJLxfHvBMcV 74RzSqU64KnJpQi9D3fkKmB+U92iVEZ6Sz74MYT1eVrhWYhZcoG2gJAnfBmBwoP6C1TL b72Q== X-Forwarded-Encrypted: i=1; AJvYcCXmUvVOBDOHUHnTEahpJpP9eT6nLLgThgPZWMtE1PixxIaAMNyVgWiQlxaiJdnFThgV+mc8ls+ixSsZyA0=@vger.kernel.org X-Gm-Message-State: AOJu0YztgFTJ1jIYoWBBwYeBfaED6ESpXFtvD8V1yZe2L7bOJd40ppvU GRo4urjTc0ByQb8LtN3siLd9ElqEZMKQ9T5PHd7Qs1vCZhW72HDIgghClLgWLcys5sfDrWuN X-Gm-Gg: ATEYQzyaj1tUzVaDUhrqoqAiwqYo6tU7TMLz7DDpYeorVB6XVelyna1rtHQzQFCOQbh NWikSin8bUHs0tHNOxubdjPaOcoBbU8rWmdKVt2boCdP4MVbCMcTp3vNrGYehiu/rzKaqAJtJ7e X26UBLy2S9TJgNbCMrXxcL3Mf7FBPoKQyDx4P8/sh+a8plYGNypObsAd7+1fw750GXzN7MKUnLJ PiELysHCsY5k6GrGx+PypDv4j3YUG394FzgVY+rrrqWyCs1p4X4vPtcSfM1+CApcrFFxa3m+l8G TWadMEeFtCTqYPOuKfGNGA0LAd+rruxNYG4v9HEneRO7osw6xlhNKEwZnWwO4bd94ciKLEc5etm ogpH8gJGDtZXu1OUzUITUBZlojLPTxCz3pJseRx4+kSLwjLRT9r6sBnHaXJJpdwgpnVxxLcv4mo dykqcUiK9yIpnH8NaONf/+TO1Qi6BgP2nODQIHejrMvyHP7JhZ X-Received: by 2002:a17:90b:2b4e:b0:359:95c2:b3e with SMTP id 98e67ed59e1d1-359be390472mr7284097a91.30.1772988326156; Sun, 08 Mar 2026 09:45:26 -0700 (PDT) Received: from localhost.localdomain ([112.10.226.70]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-359c0179a67sm8032737a91.13.2026.03.08.09.45.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 09:45:24 -0700 (PDT) From: =?UTF-8?q?=E5=82=85=E7=BB=A7=E6=99=97?= To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, =?UTF-8?q?=E5=82=85=E7=BB=A7=E6=99=97?= Subject: [PATCH] wifi: mac80211: fix monitor mode frame capture for real chanctx drivers Date: Sun, 8 Mar 2026 16:45:10 +0000 Message-ID: <20260308164510.5927-1-fjhhz1997@gmail.com> X-Mailer: git-send-email 2.43.0 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 Commit 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers") removed the fallback path in ieee80211_monitor_start_xmit() for when the monitor interface has no channel context assigned. This broke frame capture and injection for drivers that implement real channel context ops (as opposed to the ieee80211_emulate_* helpers), such as the mt76 family, when a monitor interface runs alongside another interface (e.g. managed mode). In that scenario the (virtual) monitor sdata does not get a chanctx of its own, even though there is an active one from the other interface. Before the simplification the code fell back to local->_oper_chandef; after it, the code goes straight to fail_rcu and silently drops every injected frame. Commit d594cc6f2c58 ("wifi: mac80211: restore non-chanctx injection behaviour") restored the fallback for drivers using emulate_chanctx, but explicitly left real chanctx drivers unfixed. Fix this by falling back to the first entry in local->chanctx_list when the monitor vif has no chanctx and the driver uses real channel contexts. This is analogous to how ieee80211_hw_conf_chan() already uses the same pattern. Tested on MT7921AU (mt76) USB adapter: - v6.13: managed + monitor coexistence restored (0 -> 37 frames/5s) - v6.19: managed + monitor coexistence restored (0 -> 39 frames/5s) - v7.0-rc2: managed + monitor coexistence restored (0 -> 33 frames/5s) Cc: stable@vger.kernel.org Fixes: 0a44dfc07074 ("wifi: mac80211: simplify non-chanctx drivers") Link: https://github.com/morrownr/USB-WiFi/issues/682 Signed-off-by: =E5=82=85=E7=BB=A7=E6=99=97 --- net/mac80211/tx.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 8cdbd41..56eaf9a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2396,12 +2396,28 @@ 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 { + /* + * For real chanctx drivers (e.g. mt76), the monitor + * interface may not have a chanctx assigned when running + * concurrently with another interface. Fall back to any + * active chanctx so that injection can still work on the + * operating channel. + */ + struct ieee80211_chanctx *ctx; + + ctx =3D list_first_entry_or_null(&local->chanctx_list, + struct ieee80211_chanctx, + list); + if (ctx) + chandef =3D &ctx->conf.def; + else + goto fail_rcu; + } =20 /* * If driver/HW supports IEEE80211_CHAN_CAN_MONITOR we still --=20 2.43.0