* [PATCH] wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata
@ 2026-08-11 21:09 Ayushman Rout
2026-08-12 6:18 ` [syzbot ci] " syzbot ci
0 siblings, 1 reply; 2+ messages in thread
From: Ayushman Rout @ 2026-08-11 21:09 UTC (permalink / raw)
To: johannes
Cc: nbd, linux-wireless, linux-kernel, Ayushman Rout,
syzbot+f1ba58d6b55abd13239e
syzbot reports a NULL/invalid pointer dereference in
trace_event_raw_event_drv_net_setup_tc(), reached via
ieee80211_netdev_setup_tc() -> drv_net_setup_tc().
drv_net_setup_tc() calls get_bss_sdata(sdata) unconditionally. For an
NL80211_IFTYPE_AP_VLAN interface this does
container_of(sdata->bss, ...), but sdata->bss is only linked
opportunistically at interface-add time when a matching same-address
AP interface exists - it is not enforced, so an AP_VLAN interface can
be fully created and registered with sdata->bss left NULL.
container_of() on NULL yields a small invalid pointer rather than
NULL, which the trace_drv_net_setup_tc tracepoint then dereferences
to read the interface name.
Guard against an unbound AP_VLAN sdata before calling
get_bss_sdata(), matching the WARN_ON_ONCE(!bss) precondition already
used for this same relationship in sta_info.c. Also add
check_sdata_in_driver(), used by the neighboring
drv_net_fill_forward_path() but missing here.
The underlying gap in ieee80211_if_add() - AP_VLAN creation not
requiring a bound bss - is not fixed here; other get_bss_sdata()
callers may share the exposure.
Fixes: 61587f1556fe ("wifi: mac80211: add support for letting drivers register tc offload support")
Reported-by: syzbot+f1ba58d6b55abd13239e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f1ba58d6b55abd13239e
Signed-off-by: Ayushman Rout <ayushmanrout27@gmail.com>
---
net/mac80211/driver-ops.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index f1c0b87fddd5..ecfdb51152f4 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1702,7 +1702,23 @@ static inline int drv_net_setup_tc(struct ieee80211_local *local,
might_sleep();
+ /*
+ * An AP_VLAN interface created without a matching, same-address
+ * AP interface present never gets sdata->bss populated (see the
+ * interface-add validation in iface.c, which links bss only
+ * opportunistically and does not require it). Such an sdata is
+ * not safe to pass through get_bss_sdata(): container_of() on a
+ * NULL sdata->bss yields a small invalid pointer, which the
+ * tracepoint below then dereferences to read the interface name,
+ * causing a crash.
+ */
+ if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->bss)
+ return -EIO;
+
sdata = get_bss_sdata(sdata);
+ if (!check_sdata_in_driver(sdata))
+ return -EIO;
+
trace_drv_net_setup_tc(local, sdata, type);
if (local->ops->net_setup_tc)
ret = local->ops->net_setup_tc(&local->hw, &sdata->vif, dev,
--
2.54.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [syzbot ci] Re: wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata
2026-08-11 21:09 [PATCH] wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata Ayushman Rout
@ 2026-08-12 6:18 ` syzbot ci
0 siblings, 0 replies; 2+ messages in thread
From: syzbot ci @ 2026-08-12 6:18 UTC (permalink / raw)
To: ayushmanrout27, johannes, linux-kernel, linux-wireless, nbd,
syzbot
Cc: syzbot, syzkaller-bugs
syzbot ci has tested the following series
[v1] wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata
https://lore.kernel.org/all/20260811210926.11422-1-ayushmanrout27@gmail.com
* [PATCH] wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata
and found the following issue:
WARNING in ieee80211_netdev_setup_tc
Full report is available here:
https://ci.syzbot.org/series/db0f7870-cfa6-4a9b-b78b-225ce86c2a89
***
WARNING in ieee80211_netdev_setup_tc
tree: wireless-next
URL: https://kernel.googlesource.com/pub/scm/linux/kernel/git/wireless/wireless-next.git
base: ca800a9302764c445de0da0e84d2252400a770ee
arch: amd64
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
config: https://ci.syzbot.org/builds/e40f4f29-7949-48eb-9c12-006be4046454/config
syz repro: https://ci.syzbot.org/findings/4c184dbd-070a-4d74-8afd-085fa1b5f0a2/syz_repro
------------[ cut here ]------------
syzkaller0: Failed check-sdata-in-driver check, flags: 0x0
WARNING: net/mac80211/driver-ops.h:1719 at drv_net_setup_tc net/mac80211/driver-ops.h:1719 [inline], CPU#1: syz.1.18/5848
WARNING: net/mac80211/driver-ops.h:1719 at ieee80211_netdev_setup_tc+0x2f0/0x550 net/mac80211/iface.c:938, CPU#1: syz.1.18/5848
Modules linked in:
CPU: 1 UID: 0 PID: 5848 Comm: syz.1.18 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
RIP: 0010:drv_net_setup_tc net/mac80211/driver-ops.h:1719 [inline]
RIP: 0010:ieee80211_netdev_setup_tc+0x345/0x550 net/mac80211/iface.c:938
Code: 48 8b 02 48 8d b0 20 01 00 00 48 85 c0 48 0f 44 f1 0f b6 04 2b 84 c0 4d 89 ee 0f 85 ad 00 00 00 49 8d 84 24 68 0a 00 00 8b 10 <67> 48 0f b9 3a e9 16 fe ff ff e8 cc ee 86 f6 90 0f 0b 90 e9 75 fe
RSP: 0018:ffffc900042ff078 EFLAGS: 00010246
RAX: ffff8881709e9928 RBX: 1ffff1102e13d325 RCX: ffff8881709e9938
RDX: 0000000000000000 RSI: ffff8881709e8120 RDI: ffffffff9068ed60
RBP: dffffc0000000000 R08: ffffc900042ff157 R09: 0000000000000000
R10: ffffc900042ff128 R11: ffffffff8b3fff60 R12: ffff8881709e8ec0
R13: ffffc900042ff120 R14: ffffc900042ff120 R15: ffff8881709e8000
FS: 00007f5cd6df16c0(0000) GS:ffff8882a8f66000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00002000000012c0 CR3: 000000016f0fc000 CR4: 00000000000006f0
Call Trace:
<TASK>
tcf_block_offload_cmd+0x235/0x3b0 net/sched/cls_api.c:838
tcf_block_offload_bind net/sched/cls_api.c:875 [inline]
tcf_block_get_ext+0xfe0/0x17d0 net/sched/cls_api.c:1498
tcf_block_get+0x67/0xa0 net/sched/cls_api.c:1543
multiq_init+0x72/0x2b0 net/sched/sch_multiq.c:246
qdisc_create+0x7b5/0xf00 net/sched/sch_api.c:1337
__tc_modify_qdisc net/sched/sch_api.c:1771 [inline]
tc_modify_qdisc+0x17af/0x2390 net/sched/sch_api.c:1835
rtnetlink_rcv_msg+0x7b9/0xc00 net/core/rtnetlink.c:7121
netlink_rcv_skb+0x226/0x4a0 net/netlink/af_netlink.c:2556
netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
netlink_unicast+0x7bb/0x940 net/netlink/af_netlink.c:1345
netlink_sendmsg+0x813/0xb40 net/netlink/af_netlink.c:1900
sock_sendmsg_nosec+0x13a/0x180 net/socket.c:775
__sock_sendmsg net/socket.c:790 [inline]
____sys_sendmsg+0x54e/0x850 net/socket.c:2684
___sys_sendmsg+0x2a5/0x360 net/socket.c:2738
__sys_sendmsg net/socket.c:2770 [inline]
__do_sys_sendmsg net/socket.c:2775 [inline]
__se_sys_sendmsg net/socket.c:2773 [inline]
__x64_sys_sendmsg+0x1b1/0x290 net/socket.c:2773
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x174/0x580 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f5cd5f9e0d9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f5cd6df1028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00007f5cd6225fa0 RCX: 00007f5cd5f9e0d9
RDX: 0000000000000000 RSI: 00002000000012c0 RDI: 0000000000000004
RBP: 00007f5cd6035024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f5cd6226038 R14: 00007f5cd6225fa0 R15: 00007ffc6aba2558
</TASK>
----------------
Code disassembly (best guess):
0: 48 8b 02 mov (%rdx),%rax
3: 48 8d b0 20 01 00 00 lea 0x120(%rax),%rsi
a: 48 85 c0 test %rax,%rax
d: 48 0f 44 f1 cmove %rcx,%rsi
11: 0f b6 04 2b movzbl (%rbx,%rbp,1),%eax
15: 84 c0 test %al,%al
17: 4d 89 ee mov %r13,%r14
1a: 0f 85 ad 00 00 00 jne 0xcd
20: 49 8d 84 24 68 0a 00 lea 0xa68(%r12),%rax
27: 00
28: 8b 10 mov (%rax),%edx
* 2a: 67 48 0f b9 3a ud1 (%edx),%rdi <-- trapping instruction
2f: e9 16 fe ff ff jmp 0xfffffe4a
34: e8 cc ee 86 f6 call 0xf686ef05
39: 90 nop
3a: 0f 0b ud2
3c: 90 nop
3d: e9 .byte 0xe9
3e: 75 fe jne 0x3e
***
If these findings have caused you to resend the series or submit a
separate fix, please add the following tag to your commit message:
Tested-by: syzbot@syzkaller.appspotmail.com
---
This report is generated by a bot. It may contain errors.
syzbot ci engineers can be reached at syzkaller@googlegroups.com.
To test a patch for this bug, please reply with `#syz test`
(should be on a separate line).
The patch should be attached to the email.
Note: arguments like custom git repos and branches are not supported.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-12 6:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 21:09 [PATCH] wifi: mac80211: guard drv_net_setup_tc() against unbound AP_VLAN sdata Ayushman Rout
2026-08-12 6:18 ` [syzbot ci] " syzbot ci
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox