================================================================== BUG: KASAN: slab-use-after-free in device_for_each_child+0xa8/0x174 drivers/base/core.c:4006 Read of size 8 at addr ffff0000c9a5d308 by task kbnepd bnep0/7262 CPU: 0 UID: 0 PID: 7262 Comm: kbnepd bnep0 Not tainted 6.11.0-rc3-syzkaller-00019-g5c43d43bad35 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:119 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 device_for_each_child+0xa8/0x174 drivers/base/core.c:4006 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2106 unregister_netdevice_many_notify+0x15c0/0x1bc0 net/core/dev.c:11378 unregister_netdevice_many net/core/dev.c:11406 [inline] unregister_netdevice_queue net/core/dev.c:11281 [inline] unregister_netdevice include/linux/netdevice.h:3129 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11424 bnep_session+0x23cc/0x258c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Allocated by task 7222: 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:370 [inline] __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4158 [inline] __kmalloc_noprof+0x2a4/0x498 mm/slub.c:4170 kmalloc_noprof include/linux/slab.h:685 [inline] kzalloc_noprof include/linux/slab.h:807 [inline] hci_alloc_dev_priv+0x30/0x1ae0 net/bluetooth/hci_core.c:2434 hci_alloc_dev include/net/bluetooth/hci_core.h:1626 [inline] __vhci_create_device drivers/bluetooth/hci_vhci.c:399 [inline] vhci_create_device+0x114/0x6c8 drivers/bluetooth/hci_vhci.c:472 vhci_get_user drivers/bluetooth/hci_vhci.c:529 [inline] vhci_write+0x324/0x3c8 drivers/bluetooth/hci_vhci.c:609 new_sync_write fs/read_write.c:497 [inline] vfs_write+0x940/0xc80 fs/read_write.c:590 ksys_write+0x15c/0x26c fs/read_write.c:643 __do_sys_write fs/read_write.c:655 [inline] __se_sys_write fs/read_write.c:652 [inline] __arm64_sys_write+0x7c/0x90 fs/read_write.c:652 __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 7222: 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+0x128/0x180 mm/kasan/common.c:240 __kasan_slab_free+0x3c/0x70 mm/kasan/common.c:256 kasan_slab_free include/linux/kasan.h:184 [inline] slab_free_hook mm/slub.c:2252 [inline] slab_free mm/slub.c:4473 [inline] kfree+0x154/0x3e0 mm/slub.c:4594 hci_release_dev+0x1044/0x11a4 net/bluetooth/hci_core.c:2753 bt_host_release+0x70/0x88 net/bluetooth/hci_sysfs.c:94 device_release+0x8c/0x1ac kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x2a8/0x41c lib/kobject.c:737 put_device+0x28/0x40 drivers/base/core.c:3790 hci_free_dev+0x24/0x34 net/bluetooth/hci_core.c:2559 vhci_release+0x84/0xd0 drivers/bluetooth/hci_vhci.c:667 __fput+0x1bc/0x774 fs/file_table.c:422 ____fput+0x20/0x30 fs/file_table.c:450 task_work_run+0x230/0x2e0 kernel/task_work.c:228 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x4ec/0x1ad0 kernel/exit.c:882 do_group_exit+0x194/0x22c kernel/exit.c:1031 __do_sys_exit_group kernel/exit.c:1042 [inline] __se_sys_exit_group kernel/exit.c:1040 [inline] pid_child_should_wake+0x0/0x1dc kernel/exit.c:1040 __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 Last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:47 __kasan_record_aux_stack+0xd0/0xec mm/kasan/generic.c:541 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:551 insert_work+0x54/0x2d4 kernel/workqueue.c:2185 __queue_work+0xe20/0x1308 kernel/workqueue.c:2341 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:621 [inline] hci_send_acl+0x768/0xa50 net/bluetooth/hci_core.c:3230 l2cap_do_send net/bluetooth/l2cap_core.c:996 [inline] l2cap_chan_send+0x1214/0x213c net/bluetooth/l2cap_core.c:2533 l2cap_sock_sendmsg+0x184/0x2a8 net/bluetooth/l2cap_sock.c:1128 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_sendmsg net/socket.c:768 [inline] kernel_sendmsg+0x1d0/0x2e4 net/socket.c:792 bnep_tx_frame net/bluetooth/bnep/core.c:466 [inline] bnep_session+0x1f30/0x258c net/bluetooth/bnep/core.c:509 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Second to last potentially related work creation: kasan_save_stack+0x40/0x6c mm/kasan/common.c:47 __kasan_record_aux_stack+0xd0/0xec mm/kasan/generic.c:541 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:551 insert_work+0x54/0x2d4 kernel/workqueue.c:2185 __queue_work+0xe20/0x1308 kernel/workqueue.c:2341 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2392 queue_work include/linux/workqueue.h:621 [inline] hci_send_acl+0x768/0xa50 net/bluetooth/hci_core.c:3230 l2cap_do_send net/bluetooth/l2cap_core.c:996 [inline] l2cap_chan_send+0x1214/0x213c net/bluetooth/l2cap_core.c:2533 l2cap_sock_sendmsg+0x184/0x2a8 net/bluetooth/l2cap_sock.c:1128 sock_sendmsg_nosec net/socket.c:730 [inline] __sock_sendmsg net/socket.c:745 [inline] sock_sendmsg net/socket.c:768 [inline] kernel_sendmsg+0x1d0/0x2e4 net/socket.c:792 bnep_tx_frame net/bluetooth/bnep/core.c:466 [inline] bnep_session+0x1f30/0x258c net/bluetooth/bnep/core.c:509 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 The buggy address belongs to the object at ffff0000c9a5c000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4872 bytes inside of freed 8192-byte region [ffff0000c9a5c000, ffff0000c9a5e000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109a58 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x5ffc00000000040(head|node=0|zone=2|lastcpupid=0x7ff) page_type: 0xfdffffff(slab) raw: 05ffc00000000040 ffff0000c0002280 fffffdffc390ca00 dead000000000002 raw: 0000000000000000 0000000000020002 00000001fdffffff 0000000000000000 head: 05ffc00000000040 ffff0000c0002280 fffffdffc390ca00 dead000000000002 head: 0000000000000000 0000000000020002 00000001fdffffff 0000000000000000 head: 05ffc00000000003 fffffdffc3269601 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c9a5d200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c9a5d280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c9a5d300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c9a5d380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c9a5d400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in kernel/locking/qspinlock.c:131:9 index 14709 is out of range for type 'unsigned long[8]' CPU: 0 UID: 0 PID: 7262 Comm: kbnepd bnep0 Tainted: G B 6.11.0-rc3-syzkaller-00019-g5c43d43bad35 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call trace: dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:317 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:324 __dump_stack lib/dump_stack.c:93 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:119 dump_stack+0x1c/0x28 lib/dump_stack.c:128 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_out_of_bounds+0xf8/0x148 lib/ubsan.c:429 decode_tail kernel/locking/qspinlock.c:131 [inline] queued_spin_lock_slowpath+0x974/0xd00 kernel/locking/qspinlock.c:468 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x2ec/0x334 kernel/locking/spinlock_debug.c:116 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x64/0x7c kernel/locking/spinlock.c:162 klist_next+0x8c/0x2e4 lib/klist.c:382 next_device drivers/base/core.c:3932 [inline] device_for_each_child+0xc0/0x174 drivers/base/core.c:4010 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2106 unregister_netdevice_many_notify+0x15c0/0x1bc0 net/core/dev.c:11378 unregister_netdevice_many net/core/dev.c:11406 [inline] unregister_netdevice_queue net/core/dev.c:11281 [inline] unregister_netdevice include/linux/netdevice.h:3129 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11424 bnep_session+0x23cc/0x258c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 ---[ end trace ]--- Unable to handle kernel paging request at virtual address f89f9bdf401e2f7e KASAN: maybe wild-memory-access in range [0xc500defa00f17bf0-0xc500defa00f17bf7] 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 [f89f9bdf401e2f7e] address between user and kernel address ranges Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP Modules linked in: CPU: 0 UID: 0 PID: 7262 Comm: kbnepd bnep0 Tainted: G B 6.11.0-rc3-syzkaller-00019-g5c43d43bad35 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : queued_spin_lock_slowpath+0x3b4/0xd00 kernel/locking/qspinlock.c:471 lr : decode_tail kernel/locking/qspinlock.c:131 [inline] lr : queued_spin_lock_slowpath+0x974/0xd00 kernel/locking/qspinlock.c:468 sp : ffff8000992d74a0 x29: ffff8000992d7540 x28: 000000000000e5db x27: 1ffff0001325aea0 x26: dfff800000000000 x25: 1fffe0001b971300 x24: 0000000000040000 x23: ffff0001b3ce64c8 x22: c500defa00f17bf7 x21: ffff0001b3ce64c0 x20: 1fffe0003679cc98 x19: ffff0000dcb89800 x18: 0000000000000008 x17: 0000000000000000 x16: ffff800083014574 x15: ffff7000125337e4 x14: 1ffff000125337e4 x13: 0000000000000004 x12: ffffffffffffffff x11: ffff7000125337e4 x10: ffff80008f46e4c0 x9 : 0000000000000003 x8 : 18a01bdf401e2f7e x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff8000992d6bb8 x4 : ffff80008f5fb220 x3 : ffff8000801dd53c x2 : 0000000000000001 x1 : 0000000000000002 x0 : 00000000ffffffff Call trace: queued_spin_lock_slowpath+0x3b4/0xd00 kernel/locking/qspinlock.c:471 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x2ec/0x334 kernel/locking/spinlock_debug.c:116 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:111 [inline] _raw_spin_lock_irqsave+0x64/0x7c kernel/locking/spinlock.c:162 klist_next+0x8c/0x2e4 lib/klist.c:382 next_device drivers/base/core.c:3932 [inline] device_for_each_child+0xc0/0x174 drivers/base/core.c:4010 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2106 unregister_netdevice_many_notify+0x15c0/0x1bc0 net/core/dev.c:11378 unregister_netdevice_many net/core/dev.c:11406 [inline] unregister_netdevice_queue net/core/dev.c:11281 [inline] unregister_netdevice include/linux/netdevice.h:3129 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11424 bnep_session+0x23cc/0x258c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:389 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Code: f94002c8 8b190116 f9400bf9 d343fec8 (387a6908) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: f94002c8 ldr x8, [x22] 4: 8b190116 add x22, x8, x25 8: f9400bf9 ldr x25, [sp, #16] c: d343fec8 lsr x8, x22, #3 * 10: 387a6908 ldrb w8, [x8, x26] <-- trapping instruction