Skip to content

Commit 16c9244

Browse files
donnaskiezgregkh
authored andcommitted
wifi: mac80211: increase scan_ies_len for S1G
[ Upstream commit 7e2f321 ] Currently the S1G capability element is not taken into account for the scan_ies_len, which leads to a buffer length validation failure in ieee80211_prep_hw_scan() and subsequent WARN in __ieee80211_start_scan(). This prevents hw scanning from functioning. To fix ensure we accommodate for the S1G capability length. Signed-off-by: Lachlan Hodges <lachlan.hodges@morsemicro.com> Link: https://patch.msgid.link/20250826085437.3493-1-lachlan.hodges@morsemicro.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7d2897f commit 16c9244

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/mac80211/main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
945945
int result, i;
946946
enum nl80211_band band;
947947
int channels, max_bitrates;
948-
bool supp_ht, supp_vht, supp_he, supp_eht;
948+
bool supp_ht, supp_vht, supp_he, supp_eht, supp_s1g;
949949
struct cfg80211_chan_def dflt_chandef = {};
950950

951951
if (ieee80211_hw_check(hw, QUEUE_CONTROL) &&
@@ -1061,6 +1061,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
10611061
supp_vht = false;
10621062
supp_he = false;
10631063
supp_eht = false;
1064+
supp_s1g = false;
10641065
for (band = 0; band < NUM_NL80211_BANDS; band++) {
10651066
struct ieee80211_supported_band *sband;
10661067

@@ -1097,6 +1098,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
10971098
max_bitrates = sband->n_bitrates;
10981099
supp_ht = supp_ht || sband->ht_cap.ht_supported;
10991100
supp_vht = supp_vht || sband->vht_cap.vht_supported;
1101+
supp_s1g = supp_s1g || sband->s1g_cap.s1g;
11001102

11011103
for (i = 0; i < sband->n_iftype_data; i++) {
11021104
const struct ieee80211_sband_iftype_data *iftd;
@@ -1219,6 +1221,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
12191221
local->scan_ies_len +=
12201222
2 + sizeof(struct ieee80211_vht_cap);
12211223

1224+
if (supp_s1g)
1225+
local->scan_ies_len += 2 + sizeof(struct ieee80211_s1g_cap);
1226+
12221227
/*
12231228
* HE cap element is variable in size - set len to allow max size */
12241229
if (supp_he) {

0 commit comments

Comments
 (0)