Skip to contentSkip to conversation

wifi: mac80211: skip unused probe response countdown offsets

PATCH New Zhao Li 1 participant 1 message Jul 23 mac80211

lore
Share & tools
lore

Zhao Li

author
#0 lore raw

PATCH v2 1/1 wifi: mac80211: skip unused probe response countdown offsets

mac80211 copies cfg80211's variable-length countdown offset list into a zero-initialized fixed-size array, leaving unused entries at zero. The beacon branch already skips those zero entries, but the AP probe-response branch writes through them unconditionally.

When a probe-response template has no countdown offset, the write through an unused zero entry overwrites resp->data[0], corrupting the first byte of the template. cfg80211 already bounds explicitly supplied non-zero offsets in nl80211_parse_counter_offsets(), so this is a zero-sentinel bug, not an out-of-bounds write.

Skip zero probe-response offsets, matching the beacon path.

Fixes af296bdb8da4 ("mac80211: move csa counters from sdata to beacon/presp")
Assisted-by Codex:gpt-5
Assisted-by Claude:opus-4.8

---
Changes in v2:
- Describe offset zero as the unused-entry sentinel; do not claim an out-of-bounds access.

 net/mac80211/tx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/tx.c +2 -1
index 91b14112e24f0..fd4c379b3f201 100644
@@ -5249,7 +5249,8 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata,
 		if (sdata->vif.type == NL80211_IFTYPE_AP && resp) {
 			u16 *resp_offsets = resp->cntdwn_counter_offsets;
 
-			resp->data[resp_offsets[i]] = count;
+			if (resp_offsets[i])
+				resp->data[resp_offsets[i]] = count;
 		}
 	}
 }
Signature · 1 line
2.50.1 (Apple Git-155)