================================================================== BUG: KASAN: slab-use-after-free in hci_conn_unlink net/bluetooth/hci_conn.c:1076 [inline] BUG: KASAN: slab-use-after-free in hci_conn_hash_flush+0x2c0/0x2e0 net/bluetooth/hci_conn.c:2454 Write of size 8 at addr ffff88807e33c9d0 by task syz-executor.1/29534 CPU: 0 PID: 29534 Comm: syz-executor.1 Not tainted 6.3.0-rc6-syzkaller-00132-ge50b9b9e8610 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/30/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x150 lib/dump_stack.c:106 print_address_description.constprop.0+0x2c/0x3c0 mm/kasan/report.c:319 print_report mm/kasan/report.c:430 [inline] kasan_report+0x11c/0x130 mm/kasan/report.c:536 hci_conn_unlink net/bluetooth/hci_conn.c:1076 [inline] hci_conn_hash_flush+0x2c0/0x2e0 net/bluetooth/hci_conn.c:2454 hci_dev_close_sync+0x5fb/0x1200 net/bluetooth/hci_sync.c:4894 hci_dev_do_close+0x31/0x70 net/bluetooth/hci_core.c:554 hci_unregister_dev+0x1ce/0x580 net/bluetooth/hci_core.c:2702 vhci_release+0x80/0xf0 drivers/bluetooth/hci_vhci.c:568 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xad3/0x2960 kernel/exit.c:869 do_group_exit+0xd4/0x2a0 kernel/exit.c:1019 __do_sys_exit_group kernel/exit.c:1030 [inline] __se_sys_exit_group kernel/exit.c:1028 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1028 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fc5c708c169 Code: Unable to access opcode bytes at 0x7fc5c708c13f. RSP: 002b:00007fff769d20e8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007fff769d2290 RCX: 00007fc5c708c169 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 0000000000000000 R08: 0000000000000025 R09: 00007fff769d2290 R10: 0000000000000000 R11: 0000000000000246 R12: 00007fc5c70e7c72 R13: 000000000000001c R14: 0000000000000003 R15: 00007fff769d22d0 Allocated by task 29879: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] ____kasan_kmalloc mm/kasan/common.c:333 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:580 [inline] kzalloc include/linux/slab.h:720 [inline] hci_conn_add+0xb8/0x15a0 net/bluetooth/hci_conn.c:981 hci_connect_sco+0x42c/0xac0 net/bluetooth/hci_conn.c:1615 sco_connect net/bluetooth/sco.c:264 [inline] sco_sock_connect+0x2d7/0xae0 net/bluetooth/sco.c:610 __sys_connect_file+0x153/0x1a0 net/socket.c:2001 __sys_connect+0x165/0x1a0 net/socket.c:2018 __do_sys_connect net/socket.c:2028 [inline] __se_sys_connect net/socket.c:2025 [inline] __x64_sys_connect+0x73/0xb0 net/socket.c:2025 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 29534: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:521 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0xaf/0x2d0 mm/slub.c:3800 device_release+0xa3/0x240 drivers/base/core.c:2436 kobject_cleanup lib/kobject.c:681 [inline] kobject_release lib/kobject.c:712 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c2/0x4d0 lib/kobject.c:729 put_device+0x1f/0x30 drivers/base/core.c:3697 hci_conn_del+0x21d/0xa90 net/bluetooth/hci_conn.c:1143 hci_conn_hash_flush+0x1fa/0x2e0 net/bluetooth/hci_conn.c:2455 hci_dev_close_sync+0x5fb/0x1200 net/bluetooth/hci_sync.c:4894 hci_dev_do_close+0x31/0x70 net/bluetooth/hci_core.c:554 hci_unregister_dev+0x1ce/0x580 net/bluetooth/hci_core.c:2702 vhci_release+0x80/0xf0 drivers/bluetooth/hci_vhci.c:568 __fput+0x27c/0xa90 fs/file_table.c:321 task_work_run+0x16f/0x270 kernel/task_work.c:179 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xad3/0x2960 kernel/exit.c:869 do_group_exit+0xd4/0x2a0 kernel/exit.c:1019 __do_sys_exit_group kernel/exit.c:1030 [inline] __se_sys_exit_group kernel/exit.c:1028 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1028 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88807e33c000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2512 bytes inside of freed 4096-byte region [ffff88807e33c000, ffff88807e33d000) The buggy address belongs to the physical page: page:ffffea0001f8ce00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7e338 head:ffffea0001f8ce00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffff888012442140 dead000000000100 dead000000000122 raw: 0000000000000000 0000000000040004 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 0x1d2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5166, tgid 5166 (kworker/0:6), ts 495001893263, free_ts 494915204298 prep_new_page mm/page_alloc.c:2553 [inline] get_page_from_freelist+0x1190/0x2e20 mm/page_alloc.c:4326 __alloc_pages+0x1cb/0x4a0 mm/page_alloc.c:5592 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2283 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x390 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x136/0x320 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:966 [inline] __kmalloc_node_track_caller+0x4f/0x1a0 mm/slab_common.c:987 kmalloc_reserve+0xf0/0x270 net/core/skbuff.c:537 __alloc_skb+0x129/0x330 net/core/skbuff.c:606 alloc_skb include/linux/skbuff.h:1277 [inline] nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:751 [inline] nsim_dev_trap_report drivers/net/netdevsim/dev.c:808 [inline] nsim_dev_trap_report_work+0x2b1/0xc80 drivers/net/netdevsim/dev.c:853 process_one_work+0x991/0x15c0 kernel/workqueue.c:2390 worker_thread+0x669/0x1090 kernel/workqueue.c:2537 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1454 [inline] free_pcp_prepare+0x5d5/0xa50 mm/page_alloc.c:1504 free_unref_page_prepare mm/page_alloc.c:3388 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3483 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2637 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:769 [inline] slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x17c/0x3b0 mm/slub.c:3476 mt_alloc_one lib/maple_tree.c:159 [inline] mas_alloc_nodes+0x402/0x8a0 lib/maple_tree.c:1287 mas_node_count_gfp lib/maple_tree.c:1372 [inline] mas_preallocate+0x1bb/0x360 lib/maple_tree.c:5810 vma_iter_prealloc mm/internal.h:972 [inline] vma_expand+0x23b/0xc60 mm/mmap.c:683 shift_arg_pages+0x198/0x3f0 fs/exec.c:702 setup_arg_pages+0x4fb/0xa60 fs/exec.c:831 load_elf_binary+0xa70/0x4ff0 fs/binfmt_elf.c:1018 search_binary_handler fs/exec.c:1736 [inline] exec_binprm fs/exec.c:1778 [inline] bprm_execve fs/exec.c:1853 [inline] bprm_execve+0x7fd/0x1980 fs/exec.c:1809 do_execveat_common+0x72c/0x8e0 fs/exec.c:1960 do_execve fs/exec.c:2034 [inline] __do_sys_execve fs/exec.c:2110 [inline] __se_sys_execve fs/exec.c:2105 [inline] __x64_sys_execve+0x93/0xc0 fs/exec.c:2105 Memory state around the buggy address: ffff88807e33c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807e33c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807e33c980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807e33ca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807e33ca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================