================================================================== BUG: KASAN: slab-use-after-free in device_for_each_child+0xac/0x180 drivers/base/core.c:3996 Read of size 8 at addr ffff0000cf311308 by task kbnepd bnep0/7394 CPU: 1 UID: 0 PID: 7394 Comm: kbnepd bnep0 Not tainted 6.12.0-syzkaller-g7b1d1d4cfac0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __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 device_for_each_child+0xac/0x180 drivers/base/core.c:3996 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2109 unregister_netdevice_many_notify+0x15f4/0x1c64 net/core/dev.c:11441 unregister_netdevice_many net/core/dev.c:11469 [inline] unregister_netdevice_queue net/core/dev.c:11343 [inline] unregister_netdevice include/linux/netdevice.h:3118 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11487 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:862 Allocated by task 6897: 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] __do_kmalloc_node mm/slub.c:4264 [inline] __kmalloc_noprof+0x2a4/0x49c mm/slub.c:4276 kmalloc_noprof include/linux/slab.h:882 [inline] kzalloc_noprof include/linux/slab.h:1014 [inline] hci_alloc_dev_priv+0x30/0x1ae0 net/bluetooth/hci_core.c:2440 hci_alloc_dev include/net/bluetooth/hci_core.h:1621 [inline] __vhci_create_device drivers/bluetooth/hci_vhci.c:399 [inline] vhci_create_device+0x114/0x68c drivers/bluetooth/hci_vhci.c:470 vhci_get_user drivers/bluetooth/hci_vhci.c:527 [inline] vhci_write+0x324/0x3c8 drivers/bluetooth/hci_vhci.c:607 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:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 Freed by task 6897: 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:2342 [inline] slab_free mm/slub.c:4579 [inline] kfree+0x184/0x47c mm/slub.c:4727 hci_release_dev+0x1044/0x11a4 net/bluetooth/hci_core.c:2759 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:3780 hci_free_dev+0x24/0x34 net/bluetooth/hci_core.c:2565 vhci_release+0x84/0xd0 drivers/bluetooth/hci_vhci.c:665 __fput+0x1bc/0x75c fs/file_table.c:431 ____fput+0x20/0x30 fs/file_table.c:459 task_work_run+0x230/0x2e0 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0x4ec/0x1ad0 kernel/exit.c:939 do_group_exit+0x194/0x22c kernel/exit.c:1088 __do_sys_exit_group kernel/exit.c:1099 [inline] __se_sys_exit_group kernel/exit.c:1097 [inline] pid_child_should_wake+0x0/0x1dc kernel/exit.c:1097 __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:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 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:2183 __queue_work+0xcf4/0x1308 kernel/workqueue.c:2343 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2390 queue_work include/linux/workqueue.h:662 [inline] hci_cmd_timeout+0x198/0x1cc net/bluetooth/hci_core.c:1464 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:862 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:2183 __queue_work+0xe20/0x1308 kernel/workqueue.c:2339 delayed_work_timer_fn+0x74/0x90 kernel/workqueue.c:2485 call_timer_fn+0x1b4/0x8f0 kernel/time/timer.c:1794 expire_timers kernel/time/timer.c:1840 [inline] __run_timers kernel/time/timer.c:2419 [inline] __run_timer_base+0x59c/0x7b4 kernel/time/timer.c:2430 run_timer_base kernel/time/timer.c:2439 [inline] run_timer_softirq+0xcc/0x194 kernel/time/timer.c:2449 handle_softirqs+0x2e0/0xbf8 kernel/softirq.c:554 __do_softirq+0x14/0x20 kernel/softirq.c:588 The buggy address belongs to the object at ffff0000cf310000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4872 bytes inside of freed 8192-byte region [ffff0000cf310000, ffff0000cf312000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10f310 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: f5(slab) raw: 05ffc00000000040 ffff0000c0002280 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 05ffc00000000040 ffff0000c0002280 dead000000000122 0000000000000000 head: 0000000000000000 0000000000020002 00000001f5000000 0000000000000000 head: 05ffc00000000003 fffffdffc33cc401 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000cf311200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000cf311280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000cf311300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000cf311380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000cf311400: 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 13571 is out of range for type 'unsigned long[8]' CPU: 1 UID: 0 PID: 7394 Comm: kbnepd bnep0 Tainted: G B 6.12.0-syzkaller-g7b1d1d4cfac0 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call trace: show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:484 (C) __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:120 dump_stack+0x1c/0x28 lib/dump_stack.c:129 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:3922 [inline] device_for_each_child+0xc4/0x180 drivers/base/core.c:4000 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2109 unregister_netdevice_many_notify+0x15f4/0x1c64 net/core/dev.c:11441 unregister_netdevice_many net/core/dev.c:11469 [inline] unregister_netdevice_queue net/core/dev.c:11343 [inline] unregister_netdevice include/linux/netdevice.h:3118 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11487 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:862 ---[ end trace ]--- Unable to handle kernel paging request at virtual address ffff80008f785830 KASAN: probably user-memory-access in range [0x000000047bc2c180-0x000000047bc2c187] Mem abort info: ESR = 0x0000000096000047 EC = 0x25: DABT (current EL), IL = 32 bits SET = 0, FnV = 0 EA = 0, S1PTW = 0 FSC = 0x07: level 3 translation fault Data abort info: ISV = 0, ISS = 0x00000047, ISS2 = 0x00000000 CM = 0, WnR = 1, TnD = 0, TagAccess = 0 GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000001a5b2c000 [ffff80008f785830] pgd=0000000000000000, p4d=10000001adfba003, pud=10000001adfbb003, pmd=10000001adfbf003, pte=0000000000000000 Internal error: Oops: 0000000096000047 [#1] PREEMPT SMP Modules linked in: CPU: 1 UID: 0 PID: 7394 Comm: kbnepd bnep0 Tainted: G B 6.12.0-syzkaller-g7b1d1d4cfac0 #0 Tainted: [B]=BAD_PAGE Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 804000c5 (Nzcv daIF +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : queued_spin_lock_slowpath+0x3cc/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 : ffff8000a3f874a0 x29: ffff8000a3f87540 x28: 000000000000d413 x27: 1ffff000147f0ea0 x26: dfff800000000000 x25: 1fffe00019cad100 x24: 0000000000080000 x23: ffff0001b366e808 x22: ffff80008f785830 x21: ffff0001b366e800 x20: 1fffe000366cdd00 x19: ffff0000ce568800 x18: 0000000000000008 x17: 0000000000000000 x16: ffff80008b3ede1c x15: ffff7000125a4440 x14: 1ffff000125a4440 x13: 0000000000000004 x12: ffffffffffffffff x11: ffff7000125a4440 x10: ffff80008f785800 x9 : 0000000000000003 x8 : 0000000000000000 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff8000a3f86b98 x4 : ffff80008f90d220 x3 : ffff8000801ea08c x2 : 0000000000000001 x1 : 0000000000000004 x0 : ffff0001b366e808 Call trace: queued_spin_lock_slowpath+0x3cc/0xd00 kernel/locking/qspinlock.c:474 (P) decode_tail kernel/locking/qspinlock.c:131 [inline] (L) queued_spin_lock_slowpath+0x974/0xd00 kernel/locking/qspinlock.c:468 (L) 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:3922 [inline] device_for_each_child+0xc4/0x180 drivers/base/core.c:4000 pm_runtime_set_memalloc_noio+0xf0/0x210 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x148/0x208 net/core/net-sysfs.c:2109 unregister_netdevice_many_notify+0x15f4/0x1c64 net/core/dev.c:11441 unregister_netdevice_many net/core/dev.c:11469 [inline] unregister_netdevice_queue net/core/dev.c:11343 [inline] unregister_netdevice include/linux/netdevice.h:3118 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11487 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:862 Code: aa1603e0 9725fec9 aa1703e0 52800081 (f90002d5) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: aa1603e0 mov x0, x22 4: 9725fec9 bl 0xfffffffffc97fb28 8: aa1703e0 mov x0, x23 c: 52800081 mov w1, #0x4 // #4 * 10: f90002d5 str x21, [x22] <-- trapping instruction