Skip to content

Commit 75f87ea

Browse files
twpedersenjmberg-intel
authored andcommitted
mac80211: avoid processing non-S1G elements on S1G band
In ieee80211_determine_chantype(), the sband->ht_cap was being processed before S1G Operation element. Since the HT capability element should not be present on the S1G band, avoid processing potential garbage by moving the call to ieee80211_apply_htcap_overrides() to after the S1G block. Also, in case of a missing S1G Operation element, we would continue trying to process non-S1G elements (and return with a channel width of 20MHz). Instead, just assume primary channel is equal to operating and infer the operating width from the BSS channel, then return. Signed-off-by: Thomas Pedersen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]>
1 parent ab10c22 commit 75f87ea

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

net/mac80211/mlme.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,20 +172,23 @@ ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,
172172
ret = 0;
173173
vht_chandef = *chandef;
174174
goto out;
175-
}
176-
177-
memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap));
178-
ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap);
175+
} else if (sband->band == NL80211_BAND_S1GHZ) {
176+
if (!ieee80211_chandef_s1g_oper(s1g_oper, chandef)) {
177+
sdata_info(sdata,
178+
"Missing S1G Operation Element? Trying operating == primary\n");
179+
chandef->width = ieee80211_s1g_channel_width(channel);
180+
}
179181

180-
if (s1g_oper && sband->band == NL80211_BAND_S1GHZ) {
181-
ieee80211_chandef_s1g_oper(s1g_oper, chandef);
182182
ret = IEEE80211_STA_DISABLE_HT | IEEE80211_STA_DISABLE_40MHZ |
183183
IEEE80211_STA_DISABLE_VHT |
184184
IEEE80211_STA_DISABLE_80P80MHZ |
185185
IEEE80211_STA_DISABLE_160MHZ;
186186
goto out;
187187
}
188188

189+
memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap));
190+
ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap);
191+
189192
if (!ht_oper || !sta_ht_cap.ht_supported) {
190193
ret = IEEE80211_STA_DISABLE_HT |
191194
IEEE80211_STA_DISABLE_VHT |

0 commit comments

Comments
 (0)