================================================================== BUG: KASAN: use-after-free in hci_sock_get_cookie+0x41/0x50 net/bluetooth/hci_sock.c:95 Read of size 4 at addr ffff88805d0d0580 by task syz.5.1140/8082 CPU: 1 PID: 8082 Comm: syz.5.1140 Not tainted 5.15.189-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106 print_address_description+0x60/0x2d0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0xdf/0x130 mm/kasan/report.c:451 hci_sock_get_cookie+0x41/0x50 net/bluetooth/hci_sock.c:95 mgmt_cmd_complete+0x1f4/0x480 net/bluetooth/mgmt_util.c:163 clock_info_cmd_complete+0x263/0x430 net/bluetooth/mgmt.c:6553 cmd_complete_rsp+0x64/0x170 net/bluetooth/mgmt.c:1307 mgmt_pending_foreach+0xc1/0x110 net/bluetooth/mgmt_util.c:226 __mgmt_power_off+0x16a/0x340 net/bluetooth/mgmt.c:8638 hci_dev_do_close+0x5c8/0x1030 net/bluetooth/hci_core.c:1791 hci_dev_close+0xd7/0x180 net/bluetooth/hci_core.c:1877 sock_do_ioctl+0xd3/0x2f0 net/socket.c:1140 sock_ioctl+0x4ed/0x6e0 net/socket.c:1257 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 RIP: 0033:0x7fbb0a552be9 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:00007fbb087ba038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007fbb0a779fa0 RCX: 00007fbb0a552be9 RDX: 0000000000000000 RSI: 00000000400448ca RDI: 0000000000000004 RBP: 00007fbb0a5d5e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fbb0a77a038 R14: 00007fbb0a779fa0 R15: 00007ffc42cacef8 Allocated by task 6182: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:609 [inline] sk_prot_alloc+0xe7/0x210 net/core/sock.c:1864 sk_alloc+0x2f/0x310 net/core/sock.c:1917 hci_sock_create+0xa0/0x220 net/bluetooth/hci_sock.c:2094 bt_sock_create+0x155/0x220 net/bluetooth/af_bluetooth.c:130 __sock_create+0x47b/0x900 net/socket.c:1486 sock_create net/socket.c:1542 [inline] __sys_socket+0xe2/0x170 net/socket.c:1584 __do_sys_socket net/socket.c:1593 [inline] __se_sys_socket net/socket.c:1591 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1591 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 8083: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xea/0x170 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0xef/0x2a0 mm/slub.c:4559 sk_prot_free net/core/sock.c:1900 [inline] __sk_destruct+0x55a/0x820 net/core/sock.c:1986 sock_put include/net/sock.h:1939 [inline] mgmt_pending_free net/bluetooth/mgmt_util.c:261 [inline] mgmt_pending_remove+0x13d/0x1a0 net/bluetooth/mgmt_util.c:269 mgmt_pending_foreach+0xc1/0x110 net/bluetooth/mgmt_util.c:226 mgmt_index_removed+0x119/0x280 net/bluetooth/mgmt.c:8546 hci_sock_bind+0xa96/0xe20 net/bluetooth/hci_sock.c:1246 __sys_bind+0x2f4/0x3f0 net/socket.c:1720 __do_sys_bind net/socket.c:1731 [inline] __se_sys_bind net/socket.c:1729 [inline] __x64_sys_bind+0x76/0x80 net/socket.c:1729 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88805d0d0000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1408 bytes inside of 2048-byte region [ffff88805d0d0000, ffff88805d0d0800) The buggy address belongs to the page: page:ffffea0001743400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5d0d0 head:ffffea0001743400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888016842000 raw: 0000000000000000 0000000000080008 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 4319, ts 59857501833, free_ts 12969731604 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5474 alloc_slab_page mm/slub.c:1775 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xc0/0x4b0 mm/slub.c:1975 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] slab_alloc mm/slub.c:3228 [inline] __kmalloc+0x1cd/0x330 mm/slub.c:4403 kmalloc include/linux/slab.h:609 [inline] kzalloc include/linux/slab.h:735 [inline] tomoyo_init_log+0x19b4/0x1e40 security/tomoyo/audit.c:275 tomoyo_supervisor+0x34e/0x10d0 security/tomoyo/common.c:2097 tomoyo_audit_env_log security/tomoyo/environ.c:36 [inline] tomoyo_env_perm+0x146/0x1e0 security/tomoyo/environ.c:63 tomoyo_environ security/tomoyo/domain.c:672 [inline] tomoyo_find_next_domain+0x1593/0x1a60 security/tomoyo/domain.c:882 tomoyo_bprm_check_security+0xdd/0x120 security/tomoyo/tomoyo.c:101 security_bprm_check+0x5e/0x90 security/security.c:868 search_binary_handler fs/exec.c:1730 [inline] exec_binprm fs/exec.c:1783 [inline] bprm_execve+0x9f7/0x17d0 fs/exec.c:1852 do_execveat_common+0x51e/0x6d0 fs/exec.c:1957 do_execve fs/exec.c:2027 [inline] __do_sys_execve fs/exec.c:2103 [inline] __se_sys_execve fs/exec.c:2098 [inline] __x64_sys_execve+0x8e/0xa0 fs/exec.c:2098 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317 free_unref_page+0x94/0x280 mm/page_alloc.c:3396 free_contig_range+0x96/0xf0 mm/page_alloc.c:9393 destroy_args+0xef/0x8b0 mm/debug_vm_pgtable.c:1018 debug_vm_pgtable+0x318/0x370 mm/debug_vm_pgtable.c:1331 do_one_initcall+0x1ee/0x680 init/main.c:1302 do_initcall_level+0x137/0x1f0 init/main.c:1375 do_initcalls+0x4b/0x90 init/main.c:1391 kernel_init_freeable+0x3ce/0x560 init/main.c:1615 kernel_init+0x19/0x1b0 init/main.c:1506 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Memory state around the buggy address: ffff88805d0d0480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805d0d0500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805d0d0580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805d0d0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805d0d0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================