summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhao Li <enderaoelyther@gmail.com>2026-07-23 09:10:01 +0800
committerJohannes Berg <johannes.berg@intel.com>2026-08-02 18:23:27 +0200
commitfd2bf5e718108c00732eb07fd94a5d8830f62a9f (patch)
tree21ee9beea3850c44414fe4977282deb95701c20c
parent0e4532ec658606f76f62eb277e7a933919d36cbb (diff)
downloadlinux-next-fd2bf5e718108c00732eb07fd94a5d8830f62a9f.tar.gz
linux-next-fd2bf5e718108c00732eb07fd94a5d8830f62a9f.zip
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") Link: https://lore.kernel.org/all/20260708195911.84365-6-enderaoelyther@gmail.com/ Assisted-by: Codex:gpt-5 Assisted-by: Claude:opus-4.8 Signed-off-by: Zhao Li <enderaoelyther@gmail.com> Link: https://patch.msgid.link/20260723011001.76851-1-enderaoelyther@gmail.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/tx.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1ee2b1cfc756..3a1e2c9e1565 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -5275,7 +5275,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;
}
}
}