public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Suraj P Kizhakkethil <suraj.kizhakkethil@oss.qualcomm.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Sasha Levin <sashal@kernel.org>,
	johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH AUTOSEL 7.0-6.6] wifi: mac80211: set band information only for non-MLD when probing stations using NULL frame
Date: Mon, 20 Apr 2026 09:17:03 -0400	[thread overview]
Message-ID: <20260420132314.1023554-29-sashal@kernel.org> (raw)
In-Reply-To: <20260420132314.1023554-1-sashal@kernel.org>

From: Suraj P Kizhakkethil <suraj.kizhakkethil@oss.qualcomm.com>

[ Upstream commit 73e7df69edb6f1271ea0fa876794761e6c73e76a ]

Currently, when sending a NULL frame to probe a station, the band
information is derived from the chanctx_conf in the mac80211 vif's
bss_conf. However, for AP MLD, chanctx_conf is not assigned to the
vif's bss_conf; instead it is assigned on a per-link basis. As a result,
for AP MLD, sending a NULL packet to probe will trigger a warning.

WARNING: net/mac80211/cfg.c:4635 at ieee80211_probe_client+0x1a8/0x1d8 [mac80211], CPU#2: hostapd/244
Call trace:
 ieee80211_probe_client+0x1a8/0x1d8 [mac80211] (P)
 nl80211_probe_client+0xac/0x170 [cfg80211]
 genl_family_rcv_msg_doit+0xc8/0x134
 genl_rcv_msg+0x200/0x280
 netlink_rcv_skb+0x38/0xf0
 genl_rcv+0x34/0x48
 netlink_unicast+0x314/0x3a0
 netlink_sendmsg+0x150/0x390
 ____sys_sendmsg+0x1f4/0x21c
 ___sys_sendmsg+0x98/0xc0
 __sys_sendmsg+0x74/0xcc
 __arm64_sys_sendmsg+0x20/0x34
 invoke_syscall.constprop.0+0x4c/0xd0
 do_el0_svc+0x3c/0xd0
 el0_svc+0x28/0xc0
 el0t_64_sync_handler+0x98/0xdc
 el0t_64_sync+0x154/0x158
---[ end trace 0000000000000000 ]---

For NULL packets sent to probe stations, set the band information only
for non-MLD, since MLD transmissions does not rely on band.

Signed-off-by: Suraj P Kizhakkethil <suraj.kizhakkethil@oss.qualcomm.com>
Link: https://patch.msgid.link/20260213100126.1414398-2-suraj.kizhakkethil@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

I now have all the information needed for a complete analysis. Let me
compile the full report.

---

## PHASE 1: COMMIT MESSAGE FORENSICS

**Step 1.1: Subject Line**
- Subsystem: `wifi: mac80211`
- Action verb: "set" (conditionalize behavior)
- Summary: Set band information only for non-MLD interfaces when probing
  stations using NULL frames.

Record: [wifi: mac80211] [set/conditionalize] [Fix probe_client to
handle AP MLD correctly by skipping band derivation from vif bss_conf
chanctx_conf]

**Step 1.2: Tags**
- `Signed-off-by: Suraj P Kizhakkethil
  <suraj.kizhakkethil@oss.qualcomm.com>` — author from Qualcomm
- `Link: https://patch.msgid.link/20260213100126.1414398-2-
  suraj.kizhakkethil@oss.qualcomm.com` — mailing list patch link
- `Signed-off-by: Johannes Berg <johannes.berg@intel.com>` — mac80211
  subsystem maintainer merged this
- No Fixes: tag, no Cc: stable (expected for manual review candidates)
- No Reported-by: tag (author likely discovered it internally)

Record: Merged by Johannes Berg (mac80211 maintainer). No explicit
Fixes: tag. Qualcomm contributor.

**Step 1.3: Commit Body**
- Bug: For AP MLD, `chanctx_conf` is not assigned to the vif's
  `bss_conf` but per-link. Accessing it from
  `sdata->vif.bss_conf.chanctx_conf` returns NULL.
- Symptom: WARN_ON fires at `cfg.c:4635`, function returns -EINVAL,
  probe client functionality is completely broken for AP MLD.
- Stack trace provided: triggered via `nl80211_probe_client` ->
  `ieee80211_probe_client`, reachable from userspace hostapd.
- Root cause: The chanctx_conf architecture changed for MLD (per-link
  instead of per-vif), but this function was never updated.

Record: [WARN_ON trigger + -EINVAL return breaking probe_client for AP
MLD] [Stack trace confirms userspace reachability] [Root cause: MLD per-
link chanctx_conf not assigned at vif level]

**Step 1.4: Hidden Bug Fix Detection**
This is NOT hidden — the commit message clearly describes a warning
trigger and broken functionality. The subject says "set band information
only for non-MLD" which is effectively "fix broken AP MLD probe_client."

Record: [Direct bug fix, not disguised]

## PHASE 2: DIFF ANALYSIS

**Step 2.1: Inventory**
- 1 file modified: `net/mac80211/cfg.c`
- Lines changed: +10/-5 (net +5 lines)
- Function modified: `ieee80211_probe_client()`
- Scope: single-function surgical fix

**Step 2.2: Code Flow Change**
BEFORE: Unconditionally dereferences `sdata->vif.bss_conf.chanctx_conf`
to get band. For AP MLD, chanctx_conf is NULL, triggers WARN_ON, returns
-EINVAL.

AFTER: Checks `ieee80211_vif_is_mld()` first. If MLD, sets `band = 0`
(MLD transmissions don't rely on band). If not MLD, uses the original
chanctx_conf path unchanged.

**Step 2.3: Bug Mechanism**
Category: Logic/correctness fix — missing MLD case handling.
Mechanism: The function assumed chanctx_conf is always assigned at the
vif's bss_conf level. After MLD introduction, this is only true for non-
MLD interfaces. For MLD, chanctx_conf lives per-link.

**Step 2.4: Fix Quality**
- Obviously correct: the conditional is clean and the MLD path avoids
  the NULL dereference.
- Minimal: only touches the necessary code path.
- Regression risk: Very low. Non-MLD path is completely unchanged. MLD
  path now gets `band = 0` instead of crashing.
- Merged by Johannes Berg (mac80211 maintainer), who deeply understands
  MLD architecture.

Record: [High quality, surgical fix] [Very low regression risk]

## PHASE 3: GIT HISTORY INVESTIGATION

**Step 3.1: Blame**
- `chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf)`
  introduced by commit `d0a9123ef548de` (2022-05-10) — "wifi: mac80211:
  move some future per-link data to bss_conf"
- This was a mechanical rename moving `chanctx_conf` from `vif` to
  `vif.bss_conf` as prep for MLD
- The probe_client function itself dates back to `06500736c5d26b`
  (2011-11-04) by Johannes Berg

Record: [chanctx_conf access moved to bss_conf in d0a9123ef548de (2022)]
[Function dates to 2011]

**Step 3.2: Fixes Tag**
No Fixes: tag present. The bug was introduced when MLD AP support was
completed, making chanctx_conf per-link but not updating this function.

**Step 3.3: File History**
Recent changes to `net/mac80211/cfg.c` are mostly unrelated (key
handling, UHR support, kmalloc changes). No related prerequisite
refactoring needed.

Record: [Standalone fix, no dependencies]

**Step 3.4: Author**
- Author: Suraj P Kizhakkethil (Qualcomm) — first commit to
  net/mac80211/
- Merged by: Johannes Berg — mac80211 maintainer/creator

Record: [Author is Qualcomm WiFi engineer; maintainer reviewed and
merged]

**Step 3.5: Prerequisites**
- Requires `ieee80211_vif_is_mld()` which exists since v6.5 (commit
  `f1871abd27641`, June 2023)
- Verified present in v6.6 and v6.12

Record: [Self-contained fix; prerequisite function exists in 6.5+]

## PHASE 4: MAILING LIST RESEARCH

**Step 4.1-4.2: Patch Discussion**
- Lore was not directly accessible (anti-bot protection)
- b4 dig could not match the message-id directly
- The patch was merged by Johannes Berg, indicating it passed his review
- The Link tag confirms it went through the standard wireless review
  process

Record: [Maintainer-reviewed and merged; lore inaccessible for detailed
discussion]

**Step 4.3: Bug Report**
No explicit Reported-by. The stack trace with hostapd suggests the
author encountered this in Qualcomm AP MLD testing.

**Step 4.4-4.5: Related Patches/Stable Discussion**
The patch message-id suggests this is patch 2 of a series, but it is
self-contained — the fix only touches `ieee80211_probe_client()` and has
no code dependencies on other patches in the series.

## PHASE 5: CODE SEMANTIC ANALYSIS

**Step 5.1: Functions Modified**
- `ieee80211_probe_client()` — the only function modified

**Step 5.2: Callers**
- Called via `.probe_client` in `cfg80211_ops` (line 5632 of cfg.c)
- Called from `nl80211_probe_client()` in `net/wireless/nl80211.c`
- Triggered from userspace via netlink (hostapd uses this for station
  monitoring)

Record: [Reachable from userspace via netlink; called during normal AP
operation]

**Step 5.3-5.4: Call Chain**
Userspace (hostapd) -> netlink -> `genl_rcv_msg` ->
`nl80211_probe_client` -> `ieee80211_probe_client` -> WARN_ON + return
-EINVAL

This is a HOT path for AP MLD operation — hostapd regularly probes
stations to check if they're still connected.

**Step 5.5: Similar Patterns**
Other places in mac80211 access `sdata->vif.bss_conf.chanctx_conf` (28
occurrences across mac80211). This fix addresses only the probe_client
path.

## PHASE 6: STABLE TREE ANALYSIS

**Step 6.1: Buggy Code in Stable Trees**
- v6.6: YES — verified. The exact same buggy code exists at line 4150 in
  v6.6's cfg.c. `ieee80211_vif_is_mld()` also exists in v6.6's
  mac80211.h.
- v6.12: YES — verified. Same buggy code at line 4226. Same
  `ieee80211_vif_is_mld()`.
- v6.1: NO — `ieee80211_vif_is_mld()` does not exist in v6.1 (not an
  ancestor of v6.1). MLD was not mature enough in 6.1 to have this
  issue.

Record: [Bug affects v6.5+ stable trees, including v6.6.y and v6.12.y]

**Step 6.2: Backport Complications**
- v6.6: Minor conflict — uses `mutex_lock(&local->mtx)` instead of
  `lockdep_assert_wiphy()`. Fix code itself applies cleanly since it
  only touches the chanctx_conf logic.
- v6.12: Should apply cleanly — uses the same `lockdep_assert_wiphy()`.

Record: [v6.12: clean apply; v6.6: minor context difference in locking,
fix itself applies]

**Step 6.3: Related Fixes**
No related fixes for this specific bug already in stable.

## PHASE 7: SUBSYSTEM CONTEXT

**Step 7.1: Subsystem Criticality**
- Subsystem: WiFi/mac80211 — IMPORTANT
- Used by AP/router deployments (hostapd), all WiFi-enabled devices
- AP MLD (WiFi 7) is increasingly deployed

**Step 7.2: Subsystem Activity**
Actively developed subsystem with continuous changes. MLD support is
actively being improved.

## PHASE 8: IMPACT AND RISK ASSESSMENT

**Step 8.1: Affected Users**
Anyone running an AP MLD (WiFi 7 multi-link) configuration using
hostapd.

**Step 8.2: Trigger Conditions**
- Triggered during normal operation when hostapd probes client stations
- Happens automatically via hostapd's station monitoring
- Any AP MLD with connected stations will trigger this repeatedly
- Reachable from userspace (hostapd)

**Step 8.3: Failure Mode Severity**
- WARN_ON fires every time a station is probed — spams kernel log
- Function returns -EINVAL — station probing is completely non-
  functional for AP MLD
- Without probe_client, hostapd cannot determine if stations are still
  alive
- Severity: HIGH (functionality completely broken + WARN_ON spam)

**Step 8.4: Risk-Benefit Ratio**
- BENEFIT: HIGH — fixes broken AP MLD functionality, eliminates WARN_ON
  spam
- RISK: VERY LOW — 5-line net change, self-contained, maintainer-
  reviewed, non-MLD path completely unchanged

## PHASE 9: FINAL SYNTHESIS

**Step 9.1: Evidence Summary**

FOR backporting:
- Fixes a clear, reproducible WARN_ON trigger during normal AP MLD
  operation
- Fixes broken probe_client functionality for AP MLD (returns -EINVAL)
- Small, surgical fix (+10/-5 lines)
- Merged by Johannes Berg (mac80211 maintainer/creator)
- Affects v6.6 and v6.12 stable trees (verified)
- Stack trace in commit message proves real-world trigger
- Reachable from userspace (hostapd normal operation)
- No dependencies on other patches

AGAINST backporting:
- No explicit Fixes: tag (expected for review candidates)
- No explicit Cc: stable (expected)
- Author's first mac80211 commit (but maintainer-reviewed)

**Step 9.2: Stable Rules Checklist**
1. Obviously correct and tested? YES — clear conditional check, stack
   trace shows testing
2. Fixes a real bug? YES — WARN_ON + broken functionality
3. Important issue? YES — breaks AP MLD station probing entirely
4. Small and contained? YES — 5 net lines, single function
5. No new features? CORRECT — only fixes existing broken path
6. Can apply to stable? YES — verified code exists in v6.6 and v6.12

**Step 9.3: Exception Categories**
Not an exception category — this is a straightforward bug fix.

**Step 9.4: Decision**
Clear YES. This fixes a real, reproducible bug that completely breaks AP
MLD probe_client functionality. The fix is small, obvious, self-
contained, and maintainer-reviewed.

## Verification

- [Phase 1] Parsed tags: Link to patch.msgid.link, merged by Johannes
  Berg (mac80211 maintainer)
- [Phase 2] Diff analysis: +10/-5 lines in single function
  `ieee80211_probe_client()`, adds MLD conditional check
- [Phase 3] git blame: chanctx_conf access introduced by d0a9123ef548de
  (2022-05-10)
- [Phase 3] git show b4487c2d0edaf: unrelated older fix (2011) for
  different warning in same function
- [Phase 3] git log --author="Suraj": no prior mac80211 commits (first
  contribution, but maintainer-reviewed)
- [Phase 4] b4 dig: unable to match exact message-id, but patch link
  confirms standard review process
- [Phase 5] Grep: `ieee80211_probe_client` called via cfg80211_ops
  `.probe_client` callback from nl80211
- [Phase 5] Stack trace: confirms userspace reachability via
  nl80211_probe_client -> hostapd
- [Phase 6] git show v6.6:net/mac80211/cfg.c: confirmed same buggy code
  at line 4150
- [Phase 6] git show v6.12:net/mac80211/cfg.c: confirmed same buggy code
  at line 4226
- [Phase 6] git show v6.6:include/net/mac80211.h: confirmed
  `ieee80211_vif_is_mld()` exists
- [Phase 6] git merge-base --is-ancestor: `ieee80211_vif_is_mld` in v6.5
  and v6.6, NOT in v6.1
- [Phase 8] Failure mode: WARN_ON trigger + -EINVAL return = broken
  functionality, severity HIGH
- UNVERIFIED: Exact mailing list discussion content (lore blocked by
  anti-bot protection)

**YES**

 net/mac80211/cfg.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index b85375ceb575d..85b18f59a7821 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4629,12 +4629,17 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
 
 	qos = sta->sta.wme;
 
-	chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
-	if (WARN_ON(!chanctx_conf)) {
-		ret = -EINVAL;
-		goto unlock;
+	if (ieee80211_vif_is_mld(&sdata->vif)) {
+		/* MLD transmissions must not rely on the band */
+		band = 0;
+	} else {
+		chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
+		if (WARN_ON(!chanctx_conf)) {
+			ret = -EINVAL;
+			goto unlock;
+		}
+		band = chanctx_conf->def.chan->band;
 	}
-	band = chanctx_conf->def.chan->band;
 
 	if (qos) {
 		fc = cpu_to_le16(IEEE80211_FTYPE_DATA |
-- 
2.53.0


  parent reply	other threads:[~2026-04-20 13:24 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260420132314.1023554-1-sashal@kernel.org>
2026-04-20 13:16 ` [PATCH AUTOSEL 7.0-6.18] wifi: ath12k: Fix the assignment of logical link index Sasha Levin
2026-04-20 13:16 ` [PATCH AUTOSEL 7.0-6.12] wifi: rtw89: ser: Wi-Fi 7 reset HALT C2H after reading it Sasha Levin
2026-04-20 13:16 ` [PATCH AUTOSEL 7.0-5.10] wifi: rsi_91x_usb: do not pause rfkill polling when stopping mac80211 Sasha Levin
2026-04-20 13:16 ` [PATCH AUTOSEL 7.0-6.18] wifi: rtw88: add quirks to disable PCI ASPM and deep LPS for HP P3S95EA#ACB Sasha Levin
2026-04-20 13:16 ` [PATCH AUTOSEL 6.18] wifi: brcmfmac: validate bsscfg indices in IF events Sasha Levin
2026-04-20 13:17 ` Sasha Levin [this message]
2026-04-20 13:17 ` [PATCH AUTOSEL 7.0-6.19] wifi: mt76: avoid to set ACK for MCU command if wait_resp is not set Sasha Levin
2026-04-20 13:17 ` [PATCH AUTOSEL 7.0-6.19] wifi: rtw89: Add support for TP-Link Archer TX50U Sasha Levin
2026-04-20 13:17 ` [PATCH AUTOSEL 7.0-6.1] wifi: mac80211: use ap_addr for 4-address NULL frame destination Sasha Levin
2026-04-20 13:17 ` [PATCH AUTOSEL 7.0-6.18] wifi: ath12k: Set up MLO after SSR Sasha Levin
2026-04-20 13:18 ` [PATCH AUTOSEL 7.0-6.18] wifi: iwlwifi: mld: always assign a fw id to a vif Sasha Levin
2026-04-20 13:18 ` [PATCH AUTOSEL 6.18] wifi: wl1251: validate packet IDs before indexing tx_frames Sasha Levin
2026-04-20 13:18 ` [PATCH AUTOSEL 7.0-6.18] wifi: mt76: flush pending TX before channel switch Sasha Levin
2026-04-20 13:18 ` [PATCH AUTOSEL 7.0-6.6] wifi: mt76: fix list corruption in mt76_wcid_cleanup Sasha Levin
2026-04-20 13:18 ` [PATCH AUTOSEL 7.0-6.12] wifi: mt76: add missing lock protection in mt76_sta_state for sta_event callback Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.18] wifi: mt76: mt7996: Disable Rx hdr_trans in monitor mode Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.18] wifi: iwlwifi: restrict TOP reset to some devices Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.12] wifi: mt76: mt7925: Skip scan process during suspend Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-5.10] wifi: mt76: mt76x02: wake queues after reconfig Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.12] wifi: mt76: mt7925: resolve link after acquiring mt76 mutex Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.19] wifi: rtw89: mac: remove A-die off setting for RTL8852C and RTL8922A Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.18] wifi: mt76: mt7996: fix queue pause after scan due to wrong channel switch reason Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.18] wifi: brcmfmac: of: defer probe for MAC address Sasha Levin
2026-04-20 13:19 ` [PATCH AUTOSEL 7.0-6.19] wifi: rtw89: Add support for Buffalo WI-U3-2400XE2 Sasha Levin
2026-04-20 13:20 ` [PATCH AUTOSEL 7.0-6.19] wifi: rtw89: Add support for Elecom WDC-XE2402TU3-B Sasha Levin
2026-04-20 13:20 ` [PATCH AUTOSEL 7.0-6.6] wifi: mt76: mt7996: reset device after MCU message timeout Sasha Levin
2026-04-20 13:21 ` [PATCH AUTOSEL 7.0-5.10] wifi: rtw88: TX QOS Null data the same way as Null data Sasha Levin
2026-04-20 13:21 ` [PATCH AUTOSEL 7.0-6.18] wifi: rtw88: validate RX rate to prevent out-of-bound Sasha Levin
2026-04-20 13:21 ` [PATCH AUTOSEL 7.0-6.18] wifi: ath12k: Skip adding inactive partner vdev info Sasha Levin
2026-04-20 13:21 ` [PATCH AUTOSEL 7.0-6.18] wifi: mt76: mt7996: fix frequency separation for station STR mode Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260420132314.1023554-29-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=suraj.kizhakkethil@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox