* [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
@ 2025-06-16 16:48 syzbot
2025-06-17 1:12 ` Edward Adam Davis
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: syzbot @ 2025-06-16 16:48 UTC (permalink / raw)
To: johannes, linux-kernel, linux-wireless, netdev, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 18531f4d1c8c Merge tag 'acpi-6.16-rc2' of git://git.kernel..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=100fc5d4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=3a936e3316f9e2dc
dashboard link: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17c8710c580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e24e82580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-18531f4d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/aa1e5854fc49/vmlinux-18531f4d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ca38347f64b2/bzImage-18531f4d.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com
wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50
wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in net/mac80211/mlme.c:7224:41
index 4 is out of range for type 'u8[0]' (aka 'unsigned char[0]')
CPU: 0 UID: 0 PID: 38 Comm: kworker/u4:3 Not tainted 6.16.0-rc1-syzkaller-00182-g18531f4d1c8c #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x21fd/0x2c10 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
---[ end trace ]---
Kernel panic - not syncing: UBSAN: panic_on_warn set ...
CPU: 0 UID: 0 PID: 38 Comm: kworker/u4:3 Not tainted 6.16.0-rc1-syzkaller-00182-g18531f4d1c8c #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x99/0x250 lib/dump_stack.c:120
panic+0x2db/0x790 kernel/panic.c:382
check_panic_on_warn+0x89/0xb0 kernel/panic.c:273
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x21fd/0x2c10 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Kernel Offset: disabled
Rebooting in 86400 seconds..
---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.
If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
@ 2025-06-17 1:12 ` Edward Adam Davis
2025-06-17 1:31 ` syzbot
2025-06-17 2:15 ` Edward Adam Davis
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Edward Adam Davis @ 2025-06-17 1:12 UTC (permalink / raw)
To: syzbot+6554b492c7008bcd3385; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d46d4af60d7..c370352b7d7d 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;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-17 1:12 ` Edward Adam Davis
@ 2025-06-17 1:31 ` syzbot
0 siblings, 0 replies; 12+ messages in thread
From: syzbot @ 2025-06-17 1:31 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in net/mac80211/mlme.c:7224:41
index 4 is out of range for type 'u8[0]' (aka 'unsigned char[0]')
CPU: 0 UID: 0 PID: 1041 Comm: kworker/u4:8 Not tainted 6.16.0-rc2-syzkaller-g9afe652958c3-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x24be/0x2f20 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
---[ end trace ]---
Kernel panic - not syncing: UBSAN: panic_on_warn set ...
CPU: 0 UID: 0 PID: 1041 Comm: kworker/u4:8 Not tainted 6.16.0-rc2-syzkaller-g9afe652958c3-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x99/0x250 lib/dump_stack.c:120
panic+0x2db/0x790 kernel/panic.c:382
check_panic_on_warn+0x89/0xb0 kernel/panic.c:273
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x24be/0x2f20 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Kernel Offset: disabled
Rebooting in 86400 seconds..
Tested on:
commit: 9afe6529 Merge tag 'x86_urgent_for_6.16-rc3' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12db1e82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d11f52d3049c3790
dashboard link: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=12ae190c580000
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
2025-06-17 1:12 ` Edward Adam Davis
@ 2025-06-17 2:15 ` Edward Adam Davis
2025-06-17 2:53 ` syzbot
2025-06-17 3:23 ` Edward Adam Davis
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Edward Adam Davis @ 2025-06-17 2:15 UTC (permalink / raw)
To: syzbot+6554b492c7008bcd3385; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d46d4af60d7..c370352b7d7d 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;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-17 2:15 ` Edward Adam Davis
@ 2025-06-17 2:53 ` syzbot
0 siblings, 0 replies; 12+ messages in thread
From: syzbot @ 2025-06-17 2:53 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
------------[ cut here ]------------
UBSAN: array-index-out-of-bounds in net/mac80211/mlme.c:7224:41
index 3 is out of range for type 'u8[0]' (aka 'unsigned char[0]')
CPU: 0 UID: 0 PID: 13 Comm: kworker/u4:1 Not tainted 6.16.0-rc2-syzkaller-g9afe652958c3-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
ubsan_epilogue+0xa/0x40 lib/ubsan.c:233
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x21ff/0x2c10 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
---[ end trace ]---
Kernel panic - not syncing: UBSAN: panic_on_warn set ...
CPU: 0 UID: 0 PID: 13 Comm: kworker/u4:1 Not tainted 6.16.0-rc2-syzkaller-g9afe652958c3-dirty #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014
Workqueue: events_unbound cfg80211_wiphy_work
Call Trace:
<TASK>
dump_stack_lvl+0x99/0x250 lib/dump_stack.c:120
panic+0x2db/0x790 kernel/panic.c:382
check_panic_on_warn+0x89/0xb0 kernel/panic.c:273
__ubsan_handle_out_of_bounds+0xe9/0xf0 lib/ubsan.c:455
ieee80211_rx_mgmt_beacon+0x21ff/0x2c10 net/mac80211/mlme.c:7224
ieee80211_iface_process_skb net/mac80211/iface.c:1630 [inline]
ieee80211_iface_work+0x49c/0xfe0 net/mac80211/iface.c:1722
cfg80211_wiphy_work+0x2df/0x460 net/wireless/core.c:435
process_one_work kernel/workqueue.c:3238 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3321
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402
kthread+0x70e/0x8a0 kernel/kthread.c:464
ret_from_fork+0x3f9/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Kernel Offset: disabled
Rebooting in 86400 seconds..
Tested on:
commit: 9afe6529 Merge tag 'x86_urgent_for_6.16-rc3' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=15fdc90c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d11f52d3049c3790
dashboard link: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=11e195d4580000
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
2025-06-17 1:12 ` Edward Adam Davis
2025-06-17 2:15 ` Edward Adam Davis
@ 2025-06-17 3:23 ` Edward Adam Davis
2025-06-17 3:46 ` syzbot
2025-06-17 4:41 ` [PATCH] wifi: mac80211: fix oob " Edward Adam Davis
2025-06-17 7:46 ` [syzbot] [wireless?] UBSAN: array-index-out-of-bounds " Edward Adam Davis
4 siblings, 1 reply; 12+ messages in thread
From: Edward Adam Davis @ 2025-06-17 3:23 UTC (permalink / raw)
To: syzbot+6554b492c7008bcd3385; +Cc: linux-kernel, syzkaller-bugs
#syz test
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d46d4af60d7..c370352b7d7d 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;
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);
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-17 3:23 ` Edward Adam Davis
@ 2025-06-17 3:46 ` syzbot
0 siblings, 0 replies; 12+ messages in thread
From: syzbot @ 2025-06-17 3:46 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com
Tested-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com
Tested on:
commit: 9afe6529 Merge tag 'x86_urgent_for_6.16-rc3' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1075190c580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d11f52d3049c3790
dashboard link: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=12b44370580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] wifi: mac80211: fix oob in ieee80211_rx_mgmt_beacon
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
` (2 preceding siblings ...)
2025-06-17 3:23 ` Edward Adam Davis
@ 2025-06-17 4:41 ` Edward Adam Davis
2025-06-17 6:31 ` Johannes Berg
2025-06-17 6:45 ` Lachlan Hodges
2025-06-17 7:46 ` [syzbot] [wireless?] UBSAN: array-index-out-of-bounds " Edward Adam Davis
4 siblings, 2 replies; 12+ messages in thread
From: Edward Adam Davis @ 2025-06-17 4:41 UTC (permalink / raw)
To: syzbot+6554b492c7008bcd3385
Cc: johannes, linux-kernel, linux-wireless, netdev, syzkaller-bugs
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 <eadavis@qq.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
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] wifi: mac80211: fix oob in ieee80211_rx_mgmt_beacon
2025-06-17 4:41 ` [PATCH] wifi: mac80211: fix oob " Edward Adam Davis
@ 2025-06-17 6:31 ` Johannes Berg
2025-06-17 6:45 ` Lachlan Hodges
1 sibling, 0 replies; 12+ messages in thread
From: Johannes Berg @ 2025-06-17 6:31 UTC (permalink / raw)
To: Edward Adam Davis, syzbot+6554b492c7008bcd3385
Cc: linux-kernel, linux-wireless, netdev, syzkaller-bugs
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 <eadavis@qq.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];
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/
johannes
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] wifi: mac80211: fix oob in ieee80211_rx_mgmt_beacon
2025-06-17 4:41 ` [PATCH] wifi: mac80211: fix oob " Edward Adam Davis
2025-06-17 6:31 ` Johannes Berg
@ 2025-06-17 6:45 ` Lachlan Hodges
1 sibling, 0 replies; 12+ messages in thread
From: Lachlan Hodges @ 2025-06-17 6:45 UTC (permalink / raw)
To: Edward Adam Davis
Cc: syzbot+6554b492c7008bcd3385, johannes, linux-kernel,
linux-wireless, netdev, syzkaller-bugs
On Tue, Jun 17, 2025 at 12:41:33PM +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.
Hi,
This is incorrect according to IEEE80211-2024 9.3.4.3. In addition, the
undefined behaviour reported by the bot due to using zero length arrays
rather then variable length arrays already has a patch submitted by
Johanes - please see:
Link: https://patchwork.kernel.org/project/linux-wireless/patch/20250614003037.a3e82e882251.I2e8b58e56ff2a9f8b06c66f036578b7c1d4e4685@changeid/
lachlan
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
` (3 preceding siblings ...)
2025-06-17 4:41 ` [PATCH] wifi: mac80211: fix oob " Edward Adam Davis
@ 2025-06-17 7:46 ` Edward Adam Davis
2025-06-17 8:09 ` syzbot
4 siblings, 1 reply; 12+ messages in thread
From: Edward Adam Davis @ 2025-06-17 7:46 UTC (permalink / raw)
To: syzbot+6554b492c7008bcd3385; +Cc: linux-kernel, syzkaller-bugs
#syz test
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[];
} __packed s1g_beacon;
} u;
} __packed __aligned(2);
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon
2025-06-17 7:46 ` [syzbot] [wireless?] UBSAN: array-index-out-of-bounds " Edward Adam Davis
@ 2025-06-17 8:09 ` syzbot
0 siblings, 0 replies; 12+ messages in thread
From: syzbot @ 2025-06-17 8:09 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com
Tested-by: syzbot+6554b492c7008bcd3385@syzkaller.appspotmail.com
Tested on:
commit: 9afe6529 Merge tag 'x86_urgent_for_6.16-rc3' of git://..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14a19e82580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d11f52d3049c3790
dashboard link: https://syzkaller.appspot.com/bug?extid=6554b492c7008bcd3385
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
patch: https://syzkaller.appspot.com/x/patch.diff?x=17b94370580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-06-17 8:09 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 16:48 [syzbot] [wireless?] UBSAN: array-index-out-of-bounds in ieee80211_rx_mgmt_beacon syzbot
2025-06-17 1:12 ` Edward Adam Davis
2025-06-17 1:31 ` syzbot
2025-06-17 2:15 ` Edward Adam Davis
2025-06-17 2:53 ` syzbot
2025-06-17 3:23 ` Edward Adam Davis
2025-06-17 3:46 ` syzbot
2025-06-17 4:41 ` [PATCH] wifi: mac80211: fix oob " Edward Adam Davis
2025-06-17 6:31 ` Johannes Berg
2025-06-17 6:45 ` Lachlan Hodges
2025-06-17 7:46 ` [syzbot] [wireless?] UBSAN: array-index-out-of-bounds " Edward Adam Davis
2025-06-17 8:09 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).