================================================================== BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_sync+0x40/0xe4 net/bluetooth/mgmt.c:5468 Read of size 8 at addr ffff0000c94be418 by task kworker/u9:2/6421 CPU: 1 UID: 0 PID: 6421 Comm: kworker/u9:2 Not tainted 6.12.0-rc1-syzkaller-g3eddb108abe3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Workqueue: hci0 hci_cmd_sync_work Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:319 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:326 __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x198/0x538 mm/kasan/report.c:488 kasan_report+0xd8/0x138 mm/kasan/report.c:601 __asan_report_load8_noabort+0x20/0x2c mm/kasan/report_generic.c:381 mgmt_remove_adv_monitor_sync+0x40/0xe4 net/bluetooth/mgmt.c:5468 hci_cmd_sync_work+0x1cc/0x34c net/bluetooth/hci_sync.c:328 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Allocated by task 8766: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_alloc_info+0x40/0x50 mm/kasan/generic.c:565 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:257 [inline] __kmalloc_cache_noprof+0x244/0x378 mm/slub.c:4296 kmalloc_noprof include/linux/slab.h:878 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] mgmt_pending_new+0x70/0x248 net/bluetooth/mgmt_util.c:269 mgmt_pending_add+0x48/0x11c net/bluetooth/mgmt_util.c:296 remove_adv_monitor+0x110/0x1b0 net/bluetooth/mgmt.c:5493 hci_mgmt_cmd+0x980/0xe64 net/bluetooth/hci_sock.c:1712 hci_sock_sendmsg+0x590/0xd14 net/bluetooth/hci_sock.c:1832 sock_sendmsg_nosec net/socket.c:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_write_iter+0x2d8/0x448 net/socket.c:1165 new_sync_write fs/read_write.c:590 [inline] vfs_write+0x920/0xcf4 fs/read_write.c:683 ksys_write+0x15c/0x26c fs/read_write.c:736 __do_sys_write fs/read_write.c:748 [inline] __se_sys_write fs/read_write.c:745 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:745 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 Freed by task 8719: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x40/0x78 mm/kasan/common.c:68 kasan_save_free_info+0x54/0x6c mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x64/0x8c mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:2343 [inline] slab_free mm/slub.c:4580 [inline] kfree+0x184/0x47c mm/slub.c:4728 mgmt_pending_free+0xc8/0x118 net/bluetooth/mgmt_util.c:309 mgmt_pending_remove+0xec/0x104 net/bluetooth/mgmt_util.c:315 cmd_complete_rsp+0xcc/0x17c mgmt_pending_foreach+0xd0/0x144 net/bluetooth/mgmt_util.c:259 __mgmt_power_off+0x174/0x3dc net/bluetooth/mgmt.c:9469 hci_dev_close_sync+0x4e0/0x1074 net/bluetooth/hci_sync.c:5191 hci_dev_do_close net/bluetooth/hci_core.c:483 [inline] hci_dev_close+0xe4/0x20c net/bluetooth/hci_core.c:508 hci_sock_ioctl+0x418/0x7e8 net/bluetooth/hci_sock.c:1128 sock_do_ioctl+0x134/0x2d0 net/socket.c:1227 sock_ioctl+0x4ec/0x838 net/socket.c:1346 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl fs/ioctl.c:893 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:893 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712 el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730 el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598 The buggy address belongs to the object at ffff0000c94be400 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 24 bytes inside of freed 96-byte region [ffff0000c94be400, ffff0000c94be460) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000c94be800 pfn:0x1094be flags: 0x5ffc00000000200(workingset|node=0|zone=2|lastcpupid=0x7ff) page_type: f5(slab) raw: 05ffc00000000200 ffff0000c0001280 fffffdffc349da50 fffffdffc326fa10 raw: ffff0000c94be800 0000000000200004 00000001f5000000 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c94be300: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff0000c94be380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff0000c94be400: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff0000c94be480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff0000c94be500: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ================================================================== Unable to handle kernel paging request at virtual address 000640a620000441 Mem abort info: ESR = 0x0000000096000004 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x04: level 0 translation fault Data abort info: ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000 CM = 0, WnR = 0, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [000640a620000441] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: CPU: 1 UID: 0 PID: 6421 Comm: kworker/u9:2 Tainted: G B 6.12.0-rc1-syzkaller-g3eddb108abe3 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Workqueue: hci0 hci_cmd_sync_work pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __list_del_entry_valid_or_report+0x78/0x158 lib/list_debug.c:62 lr : __list_del_entry_valid_or_report+0x4c/0x158 lib/list_debug.c:50 sp : ffff8000a3e07950 x29: ffff8000a3e07950 x28: 1ffff000147c0f3c x27: dfff800000000000 x26: 0000000000000053 x25: 0000000000000000 x24: ffff0000eed0c000 x23: ffff0000d99f4010 x22: dfff800000000000 x21: 003605310000220f x20: ffff0000d4da6d00 x19: ffff0000c94be400 x18: 1fffe000366cc476 x17: ffff80008a6273e0 x16: ffff8000805848f0 x15: 0000000000000001 x14: 1ffff0001201dd46 x13: 0000000000000000 x12: 0000000000000000 x11: ffff8000a3dfffff x10: 0000000000ff0100 x9 : ffff8000973650e0 x8 : 0006c0a620000441 x7 : ffff800080ac27bc x6 : ffff800080abf16c x5 : ffff0000e3685248 x4 : ffff80008a693ccc x3 : ffff8000830b5444 x2 : dead000000000122 x1 : 0000000000000008 x0 : 0000000000000000 Call trace: __list_del_entry_valid_or_report+0x78/0x158 lib/list_debug.c:62 __list_del_entry_valid include/linux/list.h:124 [inline] __list_del_entry include/linux/list.h:215 [inline] list_del include/linux/list.h:229 [inline] mgmt_pending_remove+0x30/0x104 net/bluetooth/mgmt_util.c:314 mgmt_remove_adv_monitor_complete+0x248/0x498 net/bluetooth/mgmt.c:5458 hci_cmd_sync_work+0x214/0x34c net/bluetooth/hci_sync.c:330 process_one_work+0x7bc/0x1600 kernel/workqueue.c:3229 process_scheduled_works kernel/workqueue.c:3310 [inline] worker_thread+0x97c/0xeec kernel/workqueue.c:3391 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Code: 91008902 eb0202bf 54000520 d343fea8 (38766908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: 91008902 add x2, x8, #0x22 4: eb0202bf cmp x21, x2 8: 54000520 b.eq 0xac // b.none c: d343fea8 lsr x8, x21, #3 * 10: 38766908 ldrb w8, [x8, x22] <-- trapping instruction