[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_8DCFF079526DB42E796E5095C0E8E2EE1E0A@qq.com>
Date: Tue, 17 Jun 2025 12:41:33 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+6554b492c7008bcd3385@...kaller.appspotmail.com
Cc: johannes@...solutions.net,
linux-kernel@...r.kernel.org,
linux-wireless@...r.kernel.org,
netdev@...r.kernel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] wifi: mac80211: fix oob in ieee80211_rx_mgmt_beacon
According to ieee80211_s1g_optional_len(), it can be clearly seen that the
maximum size of variable is 4 and it is an array. Based on the above, the
parsing of the frame control field and optional field is optimized.
Fixes: 1e1f706fc2ce ("wifi: cfg80211/mac80211: correctly parse S1G beacon optional elements")
Reported-by: syzbot+6554b492c7008bcd3385@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
Tested-by: syzbot+6554b492c7008bcd3385@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
include/linux/ieee80211.h | 2 +-
net/mac80211/mlme.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index ce377f7fb912..556ce95e0b0f 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1278,7 +1278,7 @@ struct ieee80211_ext {
u8 sa[ETH_ALEN];
__le32 timestamp;
u8 change_seq;
- u8 variable[0];
+ u8 variable[4];
} __packed s1g_beacon;
} u;
} __packed __aligned(2);
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d46d4af60d7..fb7bf95ee87b 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7222,7 +7222,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_link_data *link,
if (ieee80211_is_s1g_beacon(mgmt->frame_control)) {
struct ieee80211_ext *ext = (void *) mgmt;
variable = ext->u.s1g_beacon.variable +
- ieee80211_s1g_optional_len(ext->frame_control);
+ (ieee80211_s1g_optional_len(ext->frame_control) - 1);
}
baselen = (u8 *) variable - (u8 *) mgmt;
--
2.43.0
Powered by blists - more mailing lists