Bluetooth: Wrong link type (-71) ================================================================== BUG: KASAN: slab-use-after-free in l2cap_build_cmd net/bluetooth/l2cap_core.c:2933 [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 ffff88803216a010 by task kworker/u9:0/29069 CPU: 0 PID: 29069 Comm: kworker/u9:0 Not tainted 6.9.0-rc4-next-20240416-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Workqueue: hci4 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:2933 [inline] l2cap_send_cmd+0x679/0x8d0 net/bluetooth/l2cap_core.c:927 l2cap_recv_frame+0x8bec/0x107a0 hci_acldata_packet net/bluetooth/hci_core.c:3953 [inline] hci_rx_work+0x50f/0xca0 net/bluetooth/hci_core.c:4190 process_one_work kernel/workqueue.c:3218 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3299 worker_thread+0x86d/0xd70 kernel/workqueue.c:3380 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Allocated by task 29069: 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_noprof+0x19c/0x2b0 mm/slub.c:4109 kmalloc_noprof include/linux/slab.h:660 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] l2cap_conn_add+0xa9/0x9c0 net/bluetooth/l2cap_core.c:6844 l2cap_connect_cfm+0x136/0x1220 net/bluetooth/l2cap_core.c:7232 hci_connect_cfm+0xa2/0x150 include/net/bluetooth/hci_core.h:2020 le_conn_complete_evt+0xd28/0x12f0 net/bluetooth/hci_event.c:5905 hci_le_conn_complete_evt+0x18c/0x420 net/bluetooth/hci_event.c:5931 hci_event_func net/bluetooth/hci_event.c:7559 [inline] hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7614 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4185 process_one_work kernel/workqueue.c:3218 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3299 worker_thread+0x86d/0xd70 kernel/workqueue.c:3380 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Freed by task 13396: 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+0xe0/0x150 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:2190 [inline] slab_free mm/slub.c:4393 [inline] kfree+0x149/0x350 mm/slub.c:4514 l2cap_connect_cfm+0x11f/0x1220 net/bluetooth/l2cap_core.c:7228 hci_connect_cfm include/net/bluetooth/hci_core.h:2020 [inline] hci_conn_failed+0x1f6/0x340 net/bluetooth/hci_conn.c:1233 hci_abort_conn_sync+0x583/0xde0 net/bluetooth/hci_sync.c:5567 hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:310 process_one_work kernel/workqueue.c:3218 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3299 worker_thread+0x86d/0xd70 kernel/workqueue.c:3380 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 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:2194 __queue_work+0xb00/0xef0 kernel/workqueue.c:2350 queue_work_on+0x1c2/0x380 kernel/workqueue.c:2397 queue_work include/linux/workqueue.h:621 [inline] l2cap_conn_ready net/bluetooth/l2cap_core.c:1613 [inline] l2cap_connect_cfm+0xec2/0x1220 net/bluetooth/l2cap_core.c:7273 hci_connect_cfm+0xa2/0x150 include/net/bluetooth/hci_core.h:2020 le_conn_complete_evt+0xd28/0x12f0 net/bluetooth/hci_event.c:5905 hci_le_conn_complete_evt+0x18c/0x420 net/bluetooth/hci_event.c:5931 hci_event_func net/bluetooth/hci_event.c:7559 [inline] hci_event_packet+0xa53/0x1540 net/bluetooth/hci_event.c:7614 hci_rx_work+0x3e8/0xca0 net/bluetooth/hci_core.c:4185 process_one_work kernel/workqueue.c:3218 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3299 worker_thread+0x86d/0xd70 kernel/workqueue.c:3380 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88803216a000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 16 bytes inside of freed 1024-byte region [ffff88803216a000, ffff88803216a400) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x32168 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff80000000040(head|node=0|zone=1|lastcpupid=0xfff) page_type: 0xffffefff(slab) raw: 00fff80000000040 ffff888015041dc0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000 head: 00fff80000000040 ffff888015041dc0 dead000000000100 dead000000000122 head: 0000000000000000 0000000000100010 00000001ffffefff 0000000000000000 head: 00fff80000000003 ffffea0000c85a01 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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 0x152820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 51, tgid -742597997 (kworker/u8:3), ts 51, free_ts 1425056251587 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1476 prep_new_page mm/page_alloc.c:1484 [inline] get_page_from_freelist+0x2ce2/0x2d90 mm/page_alloc.c:3446 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4704 __alloc_pages_node_noprof include/linux/gfp.h:244 [inline] alloc_pages_node_noprof include/linux/gfp.h:271 [inline] alloc_slab_page+0x5f/0x120 mm/slub.c:2259 allocate_slab+0x5a/0x2e0 mm/slub.c:2422 new_slab mm/slub.c:2475 [inline] ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3624 __slab_alloc+0x58/0xa0 mm/slub.c:3714 __slab_alloc_node mm/slub.c:3767 [inline] slab_alloc_node mm/slub.c:3945 [inline] __do_kmalloc_node mm/slub.c:4077 [inline] __kmalloc_noprof+0x25e/0x400 mm/slub.c:4091 kmalloc_noprof include/linux/slab.h:664 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] ieee802_11_parse_elems_full+0xd5/0x2870 net/mac80211/parse.c:880 ieee802_11_parse_elems_crc net/mac80211/ieee80211_i.h:2329 [inline] ieee802_11_parse_elems net/mac80211/ieee80211_i.h:2336 [inline] ieee80211_inform_bss+0x15f/0x1080 net/mac80211/scan.c:79 rdev_inform_bss net/wireless/rdev-ops.h:418 [inline] cfg80211_inform_single_bss_data+0x1049/0x2330 net/wireless/scan.c:2277 cfg80211_inform_bss_data+0x3dd/0x5a70 net/wireless/scan.c:3101 cfg80211_inform_bss_frame_data+0x3bc/0x720 net/wireless/scan.c:3191 ieee80211_bss_info_update+0x8a7/0xbc0 net/mac80211/scan.c:226 ieee80211_rx_bss_info net/mac80211/ibss.c:1099 [inline] ieee80211_rx_mgmt_probe_beacon net/mac80211/ibss.c:1578 [inline] ieee80211_ibss_rx_queued_mgmt+0x1962/0x2d70 net/mac80211/ibss.c:1605 ieee80211_iface_process_skb net/mac80211/iface.c:1605 [inline] ieee80211_iface_work+0x8a3/0xf10 net/mac80211/iface.c:1659 page last free pid 29995 tgid 29995 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1096 [inline] free_unref_page+0xd22/0xea0 mm/page_alloc.c:2609 discard_slab mm/slub.c:2521 [inline] __put_partials+0xeb/0x130 mm/slub.c:2989 put_cpu_partial+0x17c/0x250 mm/slub.c:3064 __slab_free+0x2ea/0x3d0 mm/slub.c:4263 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x9e/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x14f/0x170 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x23/0x80 mm/kasan/common.c:322 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slub.c:3897 [inline] slab_alloc_node mm/slub.c:3957 [inline] kmem_cache_alloc_noprof+0x135/0x290 mm/slub.c:3964 ptlock_alloc+0x20/0x70 mm/memory.c:6437 ptlock_init include/linux/mm.h:2969 [inline] pagetable_pte_ctor include/linux/mm.h:2992 [inline] __pte_alloc_one_noprof include/asm-generic/pgalloc.h:73 [inline] pte_alloc_one+0xcd/0x5d0 arch/x86/mm/pgtable.c:33 __pte_alloc+0x79/0x3a0 mm/memory.c:440 copy_pte_range mm/memory.c:1092 [inline] copy_pmd_range+0x7c81/0x84c0 mm/memory.c:1238 copy_pud_range mm/memory.c:1275 [inline] copy_p4d_range mm/memory.c:1299 [inline] copy_page_range+0x99f/0xe90 mm/memory.c:1397 dup_mmap kernel/fork.c:751 [inline] dup_mm kernel/fork.c:1688 [inline] copy_mm+0x1242/0x1fb0 kernel/fork.c:1737 copy_process+0x187a/0x3dc0 kernel/fork.c:2390 kernel_clone+0x226/0x8f0 kernel/fork.c:2797 Memory state around the buggy address: ffff888032169f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888032169f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88803216a000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803216a080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803216a100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================