================================================================== BUG: KASAN: slab-use-after-free in hci_conn_del+0x47e/0x5a0 net/bluetooth/hci_conn.c:1142 Read of size 1 at addr ffff88802422e039 by task kworker/u5:1/16393 CPU: 1 PID: 16393 Comm: kworker/u5:1 Not tainted 6.4.0-rc3-syzkaller-00017-g9d646009f65d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023 Workqueue: hci5 hci_rx_work Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:351 [inline] print_report+0x163/0x540 mm/kasan/report.c:462 kasan_report+0x176/0x1b0 mm/kasan/report.c:572 hci_conn_del+0x47e/0x5a0 net/bluetooth/hci_conn.c:1142 hci_conn_complete_evt+0x3e2/0xf00 net/bluetooth/hci_event.c:3233 hci_event_func net/bluetooth/hci_event.c:7477 [inline] hci_event_packet+0x970/0x1360 net/bluetooth/hci_event.c:7529 hci_rx_work+0x446/0xa90 net/bluetooth/hci_core.c:4062 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552 kthread+0x2b8/0x350 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Allocated by task 5592: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:559 [inline] kzalloc include/linux/slab.h:680 [inline] hci_conn_add+0xc3/0x13a0 net/bluetooth/hci_conn.c:986 hci_connect_sco+0x8e/0x2b0 net/bluetooth/hci_conn.c:1663 sco_connect net/bluetooth/sco.c:264 [inline] sco_sock_connect+0x2b9/0x990 net/bluetooth/sco.c:610 __sys_connect_file net/socket.c:2003 [inline] __sys_connect+0x2cd/0x300 net/socket.c:2020 __do_sys_connect net/socket.c:2030 [inline] __se_sys_connect net/socket.c:2027 [inline] __x64_sys_connect+0x7a/0x90 net/socket.c:2027 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 16393: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4f/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:521 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3786 [inline] __kmem_cache_free+0x264/0x3c0 mm/slub.c:3799 device_release+0x95/0x1c0 kobject_cleanup lib/kobject.c:683 [inline] kobject_release lib/kobject.c:714 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x228/0x470 lib/kobject.c:731 hci_conn_del+0x321/0x5a0 net/bluetooth/hci_conn.c:1162 hci_conn_del+0x1dc/0x5a0 net/bluetooth/hci_conn.c:1137 hci_conn_complete_evt+0x3e2/0xf00 net/bluetooth/hci_event.c:3233 hci_event_func net/bluetooth/hci_event.c:7477 [inline] hci_event_packet+0x970/0x1360 net/bluetooth/hci_event.c:7529 hci_rx_work+0x446/0xa90 net/bluetooth/hci_core.c:4062 process_one_work+0x8a0/0x10e0 kernel/workqueue.c:2405 worker_thread+0xa63/0x1210 kernel/workqueue.c:2552 kthread+0x2b8/0x350 kernel/kthread.c:379 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Last potentially related work creation: kasan_save_stack+0x3f/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:491 insert_work+0x54/0x3d0 kernel/workqueue.c:1365 __queue_work+0xb37/0xf10 kernel/workqueue.c:1526 queue_delayed_work_on+0x15a/0x260 kernel/workqueue.c:1710 sco_chan_del+0xeb/0x1d0 net/bluetooth/sco.c:169 sco_sock_close net/bluetooth/sco.c:469 [inline] sco_sock_release+0xb3/0x320 net/bluetooth/sco.c:1267 __sock_release net/socket.c:653 [inline] sock_close+0xd1/0x230 net/socket.c:1397 __fput+0x3b7/0x890 fs/file_table.c:321 task_work_run+0x24a/0x300 kernel/task_work.c:179 get_signal+0x1606/0x17e0 kernel/signal.c:2650 arch_do_signal_or_restart+0x91/0x670 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88802422e000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 57 bytes inside of freed 4096-byte region [ffff88802422e000, ffff88802422f000) The buggy address belongs to the physical page: page:ffffea0000908a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x24228 head:ffffea0000908a00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() 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 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 5598, tgid 5594 (syz-executor.3), ts 233803134867, free_ts 233780885374 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1731 prep_new_page mm/page_alloc.c:1738 [inline] get_page_from_freelist+0x321c/0x33a0 mm/page_alloc.c:3502 __alloc_pages+0x255/0x670 mm/page_alloc.c:4768 alloc_slab_page+0x6a/0x160 mm/slub.c:1851 allocate_slab mm/slub.c:1998 [inline] new_slab+0x84/0x2f0 mm/slub.c:2051 ___slab_alloc+0xa85/0x10a0 mm/slub.c:3192 __slab_alloc mm/slub.c:3291 [inline] __slab_alloc_node mm/slub.c:3344 [inline] slab_alloc_node mm/slub.c:3441 [inline] __kmem_cache_alloc_node+0x1b8/0x290 mm/slub.c:3490 __do_kmalloc_node mm/slab_common.c:965 [inline] __kmalloc+0xa8/0x230 mm/slab_common.c:979 kmalloc include/linux/slab.h:563 [inline] tomoyo_realpath_from_path+0xcf/0x5e0 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x210/0x840 security/tomoyo/file.c:723 security_file_ioctl+0x71/0xa0 security/security.c:2608 __do_sys_ioctl fs/ioctl.c:864 [inline] __se_sys_ioctl+0x47/0x160 fs/ioctl.c:856 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1302 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2564 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2659 discard_slab mm/slub.c:2097 [inline] __unfreeze_partials+0x1b1/0x1f0 mm/slub.c:2636 put_cpu_partial+0x116/0x180 mm/slub.c:2712 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x14b/0x160 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x23/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook+0x68/0x3a0 mm/slab.h:711 slab_alloc_node mm/slub.c:3451 [inline] slab_alloc mm/slub.c:3459 [inline] __kmem_cache_alloc_lru mm/slub.c:3466 [inline] kmem_cache_alloc+0x11f/0x2e0 mm/slub.c:3475 getname_flags+0xbc/0x4e0 fs/namei.c:140 vfs_fstatat fs/stat.c:275 [inline] __do_sys_newfstatat fs/stat.c:446 [inline] __se_sys_newfstatat fs/stat.c:440 [inline] __x64_sys_newfstatat+0x12e/0x1d0 fs/stat.c:440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88802422df00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802422df80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802422e000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802422e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802422e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================