Bluetooth: Unknown BR/EDR signaling command 0xf9 Bluetooth: Wrong link type (-22) ================================================================== BUG: KASAN: slab-use-after-free in l2cap_build_cmd net/bluetooth/l2cap_core.c:2924 [inline] BUG: KASAN: slab-use-after-free in l2cap_send_cmd+0x679/0x8d0 net/bluetooth/l2cap_core.c:927 Read of size 4 at addr ffff888029d87010 by task kworker/u9:3/5086 CPU: 1 PID: 5086 Comm: kworker/u9:3 Not tainted 6.8.0-syzkaller-08951-gfe46a7dd189e #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: hci3 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 l2cap_build_cmd net/bluetooth/l2cap_core.c:2924 [inline] l2cap_send_cmd+0x679/0x8d0 net/bluetooth/l2cap_core.c:927 l2cap_sig_send_rej net/bluetooth/l2cap_core.c:5501 [inline] l2cap_sig_channel net/bluetooth/l2cap_core.c:5537 [inline] l2cap_recv_frame+0x2690/0x10610 net/bluetooth/l2cap_core.c:6794 hci_acldata_packet net/bluetooth/hci_core.c:3939 [inline] hci_rx_work+0x50f/0xca0 net/bluetooth/hci_core.c:4176 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Allocated by task 5090: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] kmalloc_trace+0x1db/0x360 mm/slub.c:3997 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] l2cap_conn_add+0xa9/0x9c0 net/bluetooth/l2cap_core.c:6837 l2cap_connect_cfm+0x136/0x1220 net/bluetooth/l2cap_core.c:7228 hci_connect_cfm include/net/bluetooth/hci_core.h:2007 [inline] hci_remote_features_evt+0x68b/0xa70 net/bluetooth/hci_event.c:3753 hci_event_func net/bluetooth/hci_event.c:7517 [inline] hci_event_packet+0xac0/0x1540 net/bluetooth/hci_event.c:7569 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Freed by task 5090: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579 poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240 __kasan_slab_free+0x37/0x60 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2106 [inline] slab_free mm/slub.c:4280 [inline] kfree+0x14a/0x380 mm/slub.c:4390 l2cap_connect_cfm+0x11f/0x1220 net/bluetooth/l2cap_core.c:7224 hci_connect_cfm include/net/bluetooth/hci_core.h:2007 [inline] hci_conn_failed+0x1f6/0x340 net/bluetooth/hci_conn.c:1230 hci_abort_conn_sync+0x583/0xde0 net/bluetooth/hci_sync.c:5561 hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:310 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 insert_work+0x3e/0x330 kernel/workqueue.c:2248 __queue_work+0xc14/0xec0 kernel/workqueue.c:2400 call_timer_fn+0x17e/0x600 kernel/time/timer.c:1792 expire_timers kernel/time/timer.c:1838 [inline] __run_timers kernel/time/timer.c:2408 [inline] __run_timer_base+0x695/0x8e0 kernel/time/timer.c:2419 run_timer_base kernel/time/timer.c:2428 [inline] run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2438 __do_softirq+0x2bc/0x943 kernel/softirq.c:554 Second to last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:47 __kasan_record_aux_stack+0xac/0xc0 mm/kasan/generic.c:541 insert_work+0x3e/0x330 kernel/workqueue.c:2248 __queue_work+0xaf0/0xec0 kernel/workqueue.c:2404 queue_work_on+0x14f/0x250 kernel/workqueue.c:2435 queue_work include/linux/workqueue.h:605 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1613 [inline] l2cap_connect_cfm+0xec2/0x1220 net/bluetooth/l2cap_core.c:7269 hci_connect_cfm include/net/bluetooth/hci_core.h:2007 [inline] hci_remote_features_evt+0x68b/0xa70 net/bluetooth/hci_event.c:3753 hci_event_func net/bluetooth/hci_event.c:7517 [inline] hci_event_packet+0xac0/0x1540 net/bluetooth/hci_event.c:7569 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4171 process_one_work kernel/workqueue.c:3254 [inline] process_scheduled_works+0xa00/0x1770 kernel/workqueue.c:3335 worker_thread+0x86d/0xd70 kernel/workqueue.c:3416 kthread+0x2f0/0x390 kernel/kthread.c:388 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:243 The buggy address belongs to the object at ffff888029d87000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 16 bytes inside of freed 1024-byte region [ffff888029d87000, ffff888029d87400) The buggy address belongs to the physical page: page:ffffea0000a76000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x29d80 head:ffffea0000a76000 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888014c41dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 19489874786, free_ts 0 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x256/0x680 mm/page_alloc.c:4569 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2175 allocate_slab mm/slub.c:2338 [inline] new_slab+0x84/0x2f0 mm/slub.c:2391 ___slab_alloc+0xc73/0x1260 mm/slub.c:3525 __slab_alloc mm/slub.c:3610 [inline] __slab_alloc_node mm/slub.c:3663 [inline] slab_alloc_node mm/slub.c:3835 [inline] kmalloc_trace+0x269/0x360 mm/slub.c:3992 kmalloc include/linux/slab.h:628 [inline] kzalloc include/linux/slab.h:749 [inline] seq_create_client1+0x52/0x670 sound/core/seq/seq_clientmgr.c:234 snd_seq_create_kernel_client+0x184/0x3f0 sound/core/seq/seq_clientmgr.c:2375 snd_virmidi_dev_attach_seq sound/core/seq/seq_virmidi.c:374 [inline] snd_virmidi_dev_register+0x239/0x7f0 sound/core/seq/seq_virmidi.c:436 snd_rawmidi_dev_register+0x399/0xf60 sound/core/rawmidi.c:1980 __snd_device_register sound/core/device.c:149 [inline] snd_device_register_all+0xc9/0x1a0 sound/core/device.c:197 snd_card_register+0x1d9/0x6c0 sound/core/init.c:885 snd_virmidi_probe+0x542/0x7a0 sound/drivers/virmidi.c:105 platform_probe+0x13a/0x1c0 drivers/base/platform.c:1404 really_probe+0x29e/0xc50 drivers/base/dd.c:658 page_owner free stack trace missing Memory state around the buggy address: ffff888029d86f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888029d86f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888029d87000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888029d87080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888029d87100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================