Skip to content

Commit 1fe44a8

Browse files
donnaskiezjmberg-intel
authored andcommitted
wifi: cfg80211: fix S1G beacon head validation in nl80211
S1G beacons contain fixed length optional fields that precede the variable length elements, ensure we take this into account when validating the beacon. This particular case was missed in 1e1f706 ("wifi: cfg80211/mac80211: correctly parse S1G beacon optional elements"). Fixes: 1d47f11 ("nl80211: correctly validate S1G beacon head") Signed-off-by: Lachlan Hodges <[email protected]> Link: https://patch.msgid.link/[email protected] [shorten/reword subject] Signed-off-by: Johannes Berg <[email protected]>
1 parent e34a79b commit 1fe44a8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/wireless/nl80211.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ static int validate_beacon_head(const struct nlattr *attr,
229229
unsigned int len = nla_len(attr);
230230
const struct element *elem;
231231
const struct ieee80211_mgmt *mgmt = (void *)data;
232+
const struct ieee80211_ext *ext;
232233
unsigned int fixedlen, hdrlen;
233234
bool s1g_bcn;
234235

@@ -237,8 +238,10 @@ static int validate_beacon_head(const struct nlattr *attr,
237238

238239
s1g_bcn = ieee80211_is_s1g_beacon(mgmt->frame_control);
239240
if (s1g_bcn) {
240-
fixedlen = offsetof(struct ieee80211_ext,
241-
u.s1g_beacon.variable);
241+
ext = (struct ieee80211_ext *)mgmt;
242+
fixedlen =
243+
offsetof(struct ieee80211_ext, u.s1g_beacon.variable) +
244+
ieee80211_s1g_optional_len(ext->frame_control);
242245
hdrlen = offsetof(struct ieee80211_ext, u.s1g_beacon);
243246
} else {
244247
fixedlen = offsetof(struct ieee80211_mgmt,

0 commit comments

Comments
 (0)