KASAN: slab-use-after-free Read in mgmt_pending_remove
Subsystems (4)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 4001bda0cc91 Merge branch 'selftests-vsock-refactor-and-im.. git tree: net-next console output: https://syzkaller.appspot.com/x/log.txt?x=17f2897c580000 kernel config: https://syzkaller.appspot.com/x/.config?x=4dda49799a90cd0f dashboard link: https://syzkaller.appspot.com/bug?extid=9aa47cd4633a3cf92a80 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11a21c12580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f1a9e5dda198/disk-4001bda0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/e0d7f0aa5468/vmlinux-4001bda0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9cef7d2ebe50/bzImage-4001bda0.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
RAX: ffffffffffffffda RBX: 00007f5543fe5fa0 RCX: 00007f5543d8f6c9
RDX: 0000000000000007 RSI: 0000200000000000 RDI: 0000000000000005
RBP: 00007f5544b69090 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001
R13: 00007f5543fe6038 R14: 00007f5543fe5fa0 R15: 00007ffe72e0a568
</TASK> Bluetooth: hci0: no memory for command ================================================================== BUG: KASAN: slab-use-after-free in mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316 Read of size 8 at addr ffff888077164818 by task syz.0.17/5989 CPU: 0 UID: 0 PID: 5989 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025 Call Trace: <TASK> dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316 set_link_security+0x5c2/0x710 net/bluetooth/mgmt.c:1918 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg+0x21c/0x270 net/socket.c:742 sock_write_iter+0x279/0x360 net/socket.c:1195 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5c9/0xb30 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5543d8f6c9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5544b69038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f5543fe5fa0 RCX: 00007f5543d8f6c9 RDX: 0000000000000007 RSI: 0000200000000000 RDI: 0000000000000005 RBP: 00007f5544b69090 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 00007f5543fe6038 R14: 00007f5543fe5fa0 R15: 00007ffe72e0a568 </TASK> Allocated by task 5989: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:400 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:417 kasan_kmalloc include/linux/kasan.h:262 [inline] __kmalloc_cache_noprof+0x3d5/0x6f0 mm/slub.c:5763 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] mgmt_pending_new+0x65/0x1e0 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x35/0x140 net/bluetooth/mgmt_util.c:296 set_link_security+0x557/0x710 net/bluetooth/mgmt.c:1910 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg+0x21c/0x270 net/socket.c:742 sock_write_iter+0x279/0x360 net/socket.c:1195 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5c9/0xb30 fs/read_write.c:686 ksys_write+0x145/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 5991: kasan_save_stack mm/kasan/common.c:56 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:77 __kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:587 kasan_save_free_info mm/kasan/kasan.h:406 [inline] poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2539 [inline] slab_free mm/slub.c:6630 [inline] kfree+0x19a/0x6d0 mm/slub.c:6837 mgmt_pending_free net/bluetooth/mgmt_util.c:311 [inline] mgmt_pending_foreach+0x30d/0x380 net/bluetooth/mgmt_util.c:257 mgmt_index_removed+0x112/0x2f0 net/bluetooth/mgmt.c:9477 hci_sock_bind+0xbe9/0x1000 net/bluetooth/hci_sock.c:1314 __sys_bind_socket net/socket.c:1874 [inline] __sys_bind+0x2c6/0x3e0 net/socket.c:1905 __do_sys_bind net/socket.c:1910 [inline] __se_sys_bind net/socket.c:1908 [inline] __x64_sys_bind+0x7a/0x90 net/socket.c:1908 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888077164800 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 24 bytes inside of
freed 96-byte region [ffff888077164800, ffff888077164860)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77164
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801a026280 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080200020 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1098, tgid 1098 (kworker/u8:6), ts 87994876358, free_ts 87976357652
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1850
prep_new_page mm/page_alloc.c:1858 [inline]
get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3884
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5183
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416
alloc_slab_page mm/slub.c:3055 [inline]
allocate_slab+0x96/0x350 mm/slub.c:3228
new_slab mm/slub.c:3282 [inline]
___slab_alloc+0xe94/0x18a0 mm/slub.c:4651
__slab_alloc+0x65/0x100 mm/slub.c:4770
__slab_alloc_node mm/slub.c:4846 [inline]
slab_alloc_node mm/slub.c:5268 [inline]
__kmalloc_cache_noprof+0x411/0x6f0 mm/slub.c:5758
kmalloc_noprof include/linux/slab.h:957 [inline]
dst_cow_metrics_generic+0x56/0x1c0 net/core/dst.c:193
dst_metrics_write_ptr include/net/dst.h:136 [inline]
dst_metric_set include/net/dst.h:197 [inline]
icmp6_dst_alloc+0x264/0x420 net/ipv6/route.c:3335
ndisc_send_skb+0x3f1/0x1510 net/ipv6/ndisc.c:491
ndisc_send_ns+0xcb/0x150 net/ipv6/ndisc.c:670
addrconf_dad_work+0xaae/0x14b0 net/ipv6/addrconf.c:4282
process_one_work kernel/workqueue.c:3263 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427
kthread+0x711/0x8a0 kernel/kthread.c:463
page last free pid 1113 tgid 1113 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1394 [inline]
__free_frozen_pages+0xbc4/0xd30 mm/page_alloc.c:2906
__slab_free+0x2e7/0x390 mm/slub.c:5962
qlink_free mm/kasan/quarantine.c:163 [inline]
qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179
kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286
__kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:352
kasan_slab_alloc include/linux/kasan.h:252 [inline]
slab_post_alloc_hook mm/slub.c:4970 [inline]
slab_alloc_node mm/slub.c:5280 [inline]
kmem_cache_alloc_node_noprof+0x433/0x710 mm/slub.c:5332
__alloc_skb+0x112/0x2d0 net/core/skbuff.c:664
alloc_skb include/linux/skbuff.h:1383 [inline]
nlmsg_new include/net/netlink.h:1055 [inline]
nl80211_send_ibss_bssid+0x8d/0x430 net/wireless/nl80211.c:19952
__cfg80211_ibss_joined+0x34a/0x440 net/wireless/ibss.c:50
cfg80211_process_wdev_events+0x38a/0x4f0 net/wireless/util.c:1143
cfg80211_process_rdev_events+0xa1/0x110 net/wireless/util.c:1170
cfg80211_event_work+0x31/0x70 net/wireless/core.c:334
process_one_work kernel/workqueue.c:3263 [inline]
process_scheduled_works+0xae1/0x17b0 kernel/workqueue.c:3346
worker_thread+0x8a0/0xda0 kernel/workqueue.c:3427
kthread+0x711/0x8a0 kernel/kthread.c:463
ret_from_fork+0x4bc/0x870 arch/x86/kernel/process.c:158
Memory state around the buggy address:
ffff888077164700: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
ffff888077164780: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc
>ffff888077164800: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
^
ffff888077164880: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
ffff888077164900: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
==================================================================---
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 [email protected].
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
#syz test
net/bluetooth/mgmt.c +2 -0
@@ -9474,7 +9474,9 @@ void mgmt_index_removed(struct hci_dev *hdev)if (hci_test_quirk (hdev,HCI_QUIRK_RAW_DEVICE ))return ; +hci_dev_lock (hdev);mgmt_pending_foreach (0 , hdev, true, cmd_complete_rsp, &match); +hci_dev_unlock (hdev);if (hci_dev_test_flag (hdev,HCI_UNCONFIGURED )) { mgmt_index_event(MGMT_EV_UNCONF_INDEX_REMOVED, hdev, NULL, 0,
syzbot
syzbotsyzbot tried to test the proposed patch but the build/boot failed:
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
022][ T5851] ? kmem_cache_free+0x19b/0x690
[ 98.045044][ T5851] do_exit+0x6b5/0x2300 [ 98.045064][ T5851] ? do_raw_spin_lock+0x121/0x290 [ 98.045083][ T5851] ? __pfx_do_exit+0x10/0x10 [ 98.045105][ T5851] do_group_exit+0x21c/0x2d0 [ 98.045124][ T5851] ? lockdep_hardirqs_on+0x9c/0x150 [ 98.045138][ T5851] get_signal+0x1285/0x1340 [ 98.045158][ T5851] arch_do_signal_or_restart+0xa0/0x790 [ 98.045181][ T5851] ? __pfx_arch_do_signal_or_restart+0x10/0x10 [ 98.045206][ T5851] ? exit_to_user_mode_loop+0x40/0x130 [ 98.045220][ T5851] exit_to_user_mode_loop+0x72/0x130 [ 98.045233][ T5851] do_syscall_64+0x2bd/0xfa0 [ 98.045247][ T5851] ? lockdep_hardirqs_on+0x9c/0x150 [ 98.045260][ T5851] ? entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 98.045274][ T5851] ? clear_bhb_loop+0x60/0xb0 [ 98.045289][ T5851] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 98.045302][ T5851] RIP: 0033:0x7f01e85915e7 [ 98.045315][ T5851] Code: Unable to access opcode bytes at 0x7f01e85915bd. [ 98.045322][ T5851] RSP: 002b:00007ffd3b28dfa8 EFLAGS: 00000202 ORIG_RAX: 0000000000000029 [ 98.045339][ T5851] RAX: 0000000000000003 RBX: 00007f01e87b1300 RCX: 00007f01e85915e7 [ 98.045350][ T5851] RDX: 0000000000000006 RSI: 0000000000000001 RDI: 0000000000000002 [ 98.045358][ T5851] RBP: 00007ffd3b28e6cc R08: 0000000000000000 R09: 00007ffd3b28e3d7 [ 98.045367][ T5851] R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000001 [ 98.045375][ T5851] R13: 00007f01e87b1280 R14: 0000000000000000 R15: 00007ffd3b28e720 [ 98.045390][ T5851] </TASK> [ 98.378540][ T12] wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 [ 98.386690][ T12] wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50 [ 98.389814][ T5858] ieee80211 phy4: Selected rate control algorithm 'minstrel_ht' [ 98.411678][ T79] wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 [ 98.419746][ T79] wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50 [ 99.353370][ T5894] chnl_net:caif_netlink_parms(): no params data found [ 99.418057][ T5894] bridge0: port 1(bridge_slave_0) entered blocking state [ 99.425428][ T5894] bridge0: port 1(bridge_slave_0) entered disabled state [ 99.432627][ T5894] bridge_slave_0: entered allmulticast mode [ 99.439520][ T5894] bridge_slave_0: entered promiscuous mode [ 99.447024][ T5894] bridge0: port 2(bridge_slave_1) entered blocking state [ 99.454503][ T5894] bridge0: port 2(bridge_slave_1) entered disabled state [ 99.462695][ T5894] bridge_slave_1: entered allmulticast mode [ 99.470917][ T5894] bridge_slave_1: entered promiscuous mode [ 99.501077][ T5894] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link [ 99.512217][ T5894] bond0: (slave bond_slave_1): Enslaving as an active interface with an up link [ 99.532942][ T5894] team0: Port device team_slave_0 added [ 99.540510][ T5894] team0: Port device team_slave_1 added [ 99.561110][ T5894] batman_adv: batadv0: Adding interface: batadv_slave_0 [ 99.568213][ T5894] batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem. [ 99.594552][ T5894] batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active [ 99.606103][ T5894] batman_adv: batadv0: Adding interface: batadv_slave_1 [ 99.613063][ T5894] batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem. [ 99.639753][ T5894] batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active [ 99.674242][ T5894] hsr_slave_0: entered promiscuous mode [ 99.680522][ T5894] hsr_slave_1: entered promiscuous mode [ 99.748239][ T5894] netdevsim netdevsim0 netdevsim0: renamed from eth0 [ 99.757893][ T5894] netdevsim netdevsim0 netdevsim1: renamed from eth1 [ 99.767651][ T5894] netdevsim netdevsim0 netdevsim2: renamed from eth2 [ 99.776497][ T5894] netdevsim netdevsim0 netdevsim3: renamed from eth3 [ 99.794605][ T5894] bridge0: port 2(bridge_slave_1) entered blocking state [ 99.801694][ T5894] bridge0: port 2(bridge_slave_1) entered forwarding state [ 99.809289][ T5894] bridge0: port 1(bridge_slave_0) entered blocking state [ 99.816402][ T5894] bridge0: port 1(bridge_slave_0) entered forwarding state [ 99.849208][ T5894] 8021q: adding VLAN 0 to HW filter on device bond0 [ 99.861911][ T79] bridge0: port 1(bridge_slave_0) entered disabled state [ 99.870963][ T79] bridge0: port 2(bridge_slave_1) entered disabled state [ 99.882660][ T5894] 8021q: adding VLAN 0 to HW filter on device team0 [ 99.895117][ T50] bridge0: port 1(bridge_slave_0) entered blocking state [ 99.902499][ T50] bridge0: port 1(bridge_slave_0) entered forwarding state [ 99.914797][ T79] bridge0: port 2(bridge_slave_1) entered blocking state [ 99.921907][ T79] bridge0: port 2(bridge_slave_1) entered forwarding state [ 100.027173][ T5894] 8021q: adding VLAN 0 to HW filter on device batadv0 [ 100.059727][ T5894] veth0_vlan: entered promiscuous mode [ 100.069248][ T5894] veth1_vlan: entered promiscuous mode [ 100.089179][ T5894] veth0_macvtap: entered promiscuous mode [ 100.098172][ T5894] veth1_macvtap: entered promiscuous mode [ 100.110792][ T5894] batman_adv: batadv0: Interface activated: batadv_slave_0 [ 100.123421][ T5894] batman_adv: batadv0: Interface activated: batadv_slave_1 [ 100.135149][ T50] netdevsim netdevsim0 netdevsim0: set [1, 0] type 2 family 0 port 6081 - 0 [ 100.144394][ T50] netdevsim netdevsim0 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0 [ 100.154732][ T50] netdevsim netdevsim0 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0 [ 100.163861][ T50] netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0 [ 100.247849][ T79] netdevsim netdevsim0 netdevsim3 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0 [ 100.282107][ T79] netdevsim netdevsim0 netdevsim2 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0 [ 100.345609][ T79] netdevsim netdevsim0 netdevsim1 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0 [ 100.431459][ T79] netdevsim netdevsim0 netdevsim0 (unregistering): unset [1, 0] type 2 family 0 port 6081 - 0 2025/11/16 08:20:35 executed programs: 0 [ 100.990449][ T5146] Bluetooth: hci1: unexpected cc 0x0c03 length: 249 > 1 [ 100.998317][ T5146] Bluetooth: hci1: unexpected cc 0x1003 length: 249 > 9 [ 101.007725][ T5146] Bluetooth: hci1: unexpected cc 0x1001 length: 249 > 9 [ 101.015889][ T5146] Bluetooth: hci1: unexpected cc 0x0c23 length: 249 > 4 [ 101.024741][ T5146] Bluetooth: hci1: unexpected cc 0x0c38 length: 249 > 2 [ 101.118697][ T5934] chnl_net:caif_netlink_parms(): no params data found [ 101.161430][ T5934] bridge0: port 1(bridge_slave_0) entered blocking state [ 101.169408][ T5934] bridge0: port 1(bridge_slave_0) entered disabled state [ 101.176899][ T5934] bridge_slave_0: entered allmulticast mode [ 101.183902][ T5934] bridge_slave_0: entered promiscuous mode [ 101.191277][ T5934] bridge0: port 2(bridge_slave_1) entered blocking state [ 101.198558][ T5934] bridge0: port 2(bridge_slave_1) entered disabled state [ 101.205858][ T5934] bridge_slave_1: entered allmulticast mode [ 101.212895][ T5934] bridge_slave_1: entered promiscuous mode [ 101.235387][ T5934] bond0: (slave bond_slave_0): Enslaving as an active interface with an up link [ 101.247326][ T5934] bond0: (slave bond_slave_1): Enslaving as an active interface with an up link [ 101.273904][ T5934] team0: Port device team_slave_0 added [ 101.280932][ T5934] team0: Port device team_slave_1 added [ 101.298158][ T5934] batman_adv: batadv0: Adding interface: batadv_slave_0 [ 101.305607][ T5934] batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem. [ 101.332185][ T5934] batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active [ 101.344400][ T5934] batman_adv: batadv0: Adding interface: batadv_slave_1 [ 101.351729][ T5934] batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1532 would solve the problem. [ 101.379297][ T5934] batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active [ 101.409545][ T5934] hsr_slave_0: entered promiscuous mode [ 101.416136][ T5934] hsr_slave_1: entered promiscuous mode [ 101.422075][ T5934] debugfs: 'hsr0' already exists in 'hsr' [ 101.428232][ T5934] Cannot create hsr debugfs directory [ 103.083403][ T5852] Bluetooth: hci1: command tx timeout [ 103.408906][ T79] bridge_slave_1: left allmulticast mode [ 103.416318][ T79] bridge_slave_1: left promiscuous mode [ 103.422340][ T79] bridge0: port 2(bridge_slave_1) entered disabled state [ 103.434700][ T79] bridge_slave_0: left allmulticast mode [ 103.440485][ T79] bridge_slave_0: left promiscuous mode [ 103.446862][ T79] bridge0: port 1(bridge_slave_0) entered disabled state [ 103.557628][ T79] bond0 (unregistering): (slave bond_slave_0): Releasing backup interface [ 103.568674][ T79] bond0 (unregistering): (slave bond_slave_1): Releasing backup interface [ 103.578654][ T79] bond0 (unregistering): Released all slaves [ 103.688535][ T79] hsr_slave_0: left promiscuous mode [ 103.699423][ T79] hsr_slave_1: left promiscuous mode [ 103.705766][ T79] batman_adv: batadv0: Interface deactivated: batadv_slave_0 [ 103.714781][ T79] batman_adv: batadv0: Removing interface: batadv_slave_0 [ 103.722702][ T79] batman_adv: batadv0: Interface deactivated: batadv_slave_1 [ 103.730697][ T79] batman_adv: batadv0: Removing interface: batadv_slave_1 [ 103.742099][ T79] veth1_macvtap: left promiscuous mode [ 103.748282][ T79] veth0_macvtap: left promiscuous mode [ 103.753965][ T79] veth1_vlan: left promiscuous mode [ 103.759445][ T79] veth0_vlan: left promiscuous mode [ 103.921563][ T79] team0 (unregistering): Port device team_slave_1 removed [ 103.932559][ T79] team0 (unregistering): Port device team_slave_0 removed [ 104.214906][ T5934] netdevsim netdevsim0 netdevsim0: renamed from eth0 [ 104.228969][ T5934] netdevsim netdevsim0 netdevsim1: renamed from eth1 [ 104.239124][ T5934] netdevsim netdevsim0 netdevsim2: renamed from eth2 [ 104.249179][ T5934] netdevsim netdevsim0 netdevsim3: renamed from eth3 [ 104.341776][ T5934] 8021q: adding VLAN 0 to HW filter on device bond0 [ 104.358525][ T5934] 8021q: adding VLAN 0 to HW filter on device team0 [ 104.375257][ T1085] bridge0: port 1(bridge_slave_0) entered blocking state [ 104.382582][ T1085] bridge0: port 1(bridge_slave_0) entered forwarding state [ 104.401872][ T1085] bridge0: port 2(bridge_slave_1) entered blocking state [ 104.409195][ T1085] bridge0: port 2(bridge_slave_1) entered forwarding state [ 104.738722][ T5934] 8021q: adding VLAN 0 to HW filter on device batadv0 [ 104.765852][ T5934] veth0_vlan: entered promiscuous mode [ 104.775508][ T5934] veth1_vlan: entered promiscuous mode [ 104.796938][ T5934] veth0_macvtap: entered promiscuous mode [ 104.805872][ T5934] veth1_macvtap: entered promiscuous mode [ 104.818189][ T5934] batman_adv: batadv0: Interface activated: batadv_slave_0 [ 104.830594][ T5934] batman_adv: batadv0: Interface activated: batadv_slave_1 [ 104.844301][ T1144] netdevsim netdevsim0 netdevsim0: set [1, 0] type 2 family 0 port 6081 - 0 [ 104.854320][ T12] netdevsim netdevsim0 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0 [ 104.866000][ T12] netdevsim netdevsim0 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0 [ 104.874997][ T12] netdevsim netdevsim0 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0 [ 104.897274][ T5934] ieee80211 phy5: Selected rate control algorithm 'minstrel_ht' [ 104.916565][ T1085] wlan0: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 [ 104.917918][ T5934] ieee80211 phy6: Selected rate control algorithm 'minstrel_ht' [ 104.928653][ T1085] wlan0: Creating new IBSS network, BSSID 50:50:50:50:50:50 SYZFAIL: failed to recv rpc fd=3 want=4 recv=0 n=0 (errno 9: Bad file descriptor) [ 104.951336][ T1085] wlan1: Created IBSS using preconfigured BSSID 50:50:50:50:50:50 [ 104.959711][ T1085] wlan1: Creating new IBSS network, BSSID 50:50:50:50:50:50
syzkaller build log:
go env (err=<nil>)
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE='auto'
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/syzkaller/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/syzkaller/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2571666063=/tmp/go-build -gno-record-gcc-switches' GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/syzkaller/jobs-2/linux/gopath/src/github.com/google/syzkaller/go.mod' GOMODCACHE='/syzkaller/jobs-2/linux/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/syzkaller/jobs-2/linux/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/syzkaller/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.24.4'
GOWORK=''
PKG_CONFIG='pkg-config'
git status (err=<nil>)
HEAD detached at 07e030dea
nothing to commit, working tree clean
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
go list -f '{{.Stale}}' -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" ./sys/syz-sysgen | grep -q false || go install -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" ./sys/syz-sysgen make .descriptions
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:31: run command via tools/syz-env for best compatibility, see:
Makefile:32: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
bin/syz-sysgen
touch .descriptions
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X github.com/google/syzkaller/prog.GitRevision=07e030dea6e6d9ca88b75bb3be2810f47083b328 -X github.com/google/syzkaller/prog.gitRevisionDate=20251112-115923" -o ./bin/linux_amd64/syz-execprog github.com/google/syzkaller/tools/syz-execprog
mkdir -p ./bin/linux_amd64
g++ -o ./bin/linux_amd64/syz-executor executor/executor.cc \ -m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -std=c++17 -I. -Iexecutor/_include -DGOOS_linux=1 -DGOARCH_amd64=1 \ -DHOSTGOOS_linux=1 -DGIT_REVISION=\"07e030dea6e6d9ca88b75bb3be2810f47083b328\"
/usr/bin/ld: /tmp/ccL2C3R3.o: in function `Connection::Connect(char const*, char const*)':
executor.cc:(.text._ZN10Connection7ConnectEPKcS1_[_ZN10Connection7ConnectEPKcS1_]+0x104): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking ./tools/check-syzos.sh 2>/dev/null
Error text is too large and was truncated, full error text is at:
https://syzkaller.appspot.com/x/error.txt?x=13ac6658580000
Tested on:
commit: c9dfb92d Merge branch 'mlx5-next' of git://git.kernel... git tree: net-next kernel config: https://syzkaller.appspot.com/x/.config?x=4dda49799a90cd0f dashboard link: https://syzkaller.appspot.com/bug?extid=9aa47cd4633a3cf92a80 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 patch: https://syzkaller.appspot.com/x/patch.diff?x=14445212580000
#syz test
net/bluetooth/hci_sock.c +2 -0
@@ -1311,7 +1311,9 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, goto done; } +hci_dev_lock (hdev);mgmt_index_removed (hdev); +hci_dev_unlock (hdev); err =hci_dev_open (hdev->id);if (err) {
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Tested on:
commit: c9dfb92d Merge branch 'mlx5-next' of git://git.kernel... git tree: net-next console output: https://syzkaller.appspot.com/x/log.txt?x=1629a212580000 kernel config: https://syzkaller.appspot.com/x/.config?x=4dda49799a90cd0f dashboard link: https://syzkaller.appspot.com/bug?extid=9aa47cd4633a3cf92a80 compiler: Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8 patch: https://syzkaller.appspot.com/x/patch.diff?x=1234dd32580000
Note: testing is done by a robot and is best-effort only.
PATCH 1/1 Bluetooth: hci_sock: Prevent race in socket write iter and sock bind
In reply to syzbotThere is a potential race condition between sock bind and socket write iter. bind may free the same cmd via mgmt_pending before write iter sends the cmd, just as syzbot reported in UAF[1].
Here we use hci_dev_lock to synchronize the two, thereby avoiding the UAF mentioned in [1].
[1]
syzbot reported:
BUG: KASAN: slab-use-after-free in mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316 Read of size 8 at addr ffff888077164818 by task syz.0.17/5989 Call Trace: mgmt_pending_remove+0x3b/0x210 net/bluetooth/mgmt_util.c:316 set_link_security+0x5c2/0x710 net/bluetooth/mgmt.c:1918 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg+0x21c/0x270 net/socket.c:742 sock_write_iter+0x279/0x360 net/socket.c:1195 Allocated by task 5989: mgmt_pending_add+0x35/0x140 net/bluetooth/mgmt_util.c:296 set_link_security+0x557/0x710 net/bluetooth/mgmt.c:1910 hci_mgmt_cmd+0x9c9/0xef0 net/bluetooth/hci_sock.c:1719 hci_sock_sendmsg+0x6ca/0xef0 net/bluetooth/hci_sock.c:1839 sock_sendmsg_nosec net/socket.c:727 [inline] __sock_sendmsg+0x21c/0x270 net/socket.c:742 sock_write_iter+0x279/0x360 net/socket.c:1195 Freed by task 5991: mgmt_pending_free net/bluetooth/mgmt_util.c:311 [inline] mgmt_pending_foreach+0x30d/0x380 net/bluetooth/mgmt_util.c:257 mgmt_index_removed+0x112/0x2f0 net/bluetooth/mgmt.c:9477 hci_sock_bind+0xbe9/0x1000 net/bluetooth/hci_sock.c:1314
--- net/bluetooth/hci_sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_sock.c +2 -0
@@ -1311,7 +1311,9 @@ static int hci_sock_bind(struct socket *sock, struct sockaddr *addr, goto done; } +hci_dev_lock (hdev);mgmt_index_removed (hdev); +hci_dev_unlock (hdev); err =hci_dev_open (hdev->id);if (err) {
Signature · 1 line
2.43.0
RE: Bluetooth: hci_sock: Prevent race in socket write iter and sock bind
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1023947
---Test result---
Test Summary:
CheckPatch PENDING 0.23 seconds GitLint PENDING 0.23 seconds SubjectPrefix PASS 0.12 seconds BuildKernel PASS 26.00 seconds CheckAllWarning PASS 28.48 seconds CheckSparse PASS 31.83 seconds BuildKernel32 PASS 24.90 seconds TestRunnerSetup PASS 498.24 seconds TestRunner_l2cap-tester PASS 23.86 seconds TestRunner_iso-tester PASS 62.72 seconds TestRunner_bnep-tester PASS 6.05 seconds TestRunner_mgmt-tester FAIL 118.04 seconds TestRunner_rfcomm-tester PASS 9.11 seconds TestRunner_sco-tester PASS 14.33 seconds TestRunner_ioctl-tester PASS 9.83 seconds TestRunner_mesh-tester FAIL 11.75 seconds TestRunner_smp-tester PASS 8.36 seconds TestRunner_userchan-tester PASS 6.52 seconds IncrementalBuild PENDING 0.51 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 492, Passed: 486 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.101 seconds LL Privacy - Set Flags 2 (Enable RL) Failed 0.148 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.264 seconds Mesh - Send cancel - 2 Timed out 1.996 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
Regards,
Linux Bluetooth
Re: [PATCH] Bluetooth: hci_sock: Prevent race in socket write iter and sock bind
In reply to Edward Adam DavisThis patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Sun, 16 Nov 2025 17:04:43 +0800 you wrote:
There is a potential race condition between sock bind and socket write iter. bind may free the same cmd via
mgmt_pendingbefore write iter sends the cmd, just as syzbot reported in UAF[1].Here we use
hci_dev_lockto synchronize the two, thereby avoiding the UAF mentioned in [1].[...]
Here is the summary with links:
- Bluetooth: hci_sock: Prevent race in socket write iter and sock bind
https://git.kernel.org/bluetooth/bluetooth-next/c/1f738d68430c
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html