Re: [PATCH] wifi: mac80211: fix oob in ieee80211_rx_mgmt_beacon
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2025-06-17 06:31:47
Also in:
linux-wireless, lkml
From: Johannes Berg <johannes@sipsolutions.net>
Date: 2025-06-17 06:31:47
Also in:
linux-wireless, lkml
On Tue, 2025-06-17 at 12:41 +0800, Edward Adam Davis wrote:
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@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385 Tested-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis <redacted> --- 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];
That's incorrect when those fields aren't present, and will result in wrong sizeof(). I believe the correct fix is one I sent before, to just make it []: https://lore.kernel.org/linux-wireless/20250614003037.a3e82e882251.I2e8b58e56ff2a9f8b06c66f036578b7c1d4e4685@changeid/ (local) johannes