================================================================== BUG: KASAN: use-after-free in device_for_each_child+0xa8/0x174 drivers/base/core.c:4044 Read of size 8 at addr ffff0000d0db95f8 by task kbnepd bnep0/6908 CPU: 1 PID: 6908 Comm: kbnepd bnep0 Not tainted 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/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:88 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114 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:4044 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+0x117c/0x1770 net/core/dev.c:11129 unregister_netdevice_many net/core/dev.c:11157 [inline] unregister_netdevice_queue net/core/dev.c:11036 [inline] unregister_netdevice include/linux/netdevice.h:3115 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11175 bnep_session+0x23bc/0x257c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x400000000 pfn:0x110db9 flags: 0x5ffe00000000000(node=0|zone=2|lastcpupid=0xfff) page_type: 0xffffffff() raw: 05ffe00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000400000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000d0db9480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff0000d0db9500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff0000d0db9580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff0000d0db9600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff0000d0db9680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== ------------[ cut here ]------------ UBSAN: array-index-out-of-bounds in kernel/locking/qspinlock.c:131:9 index 12429 is out of range for type 'unsigned long[8]' CPU: 1 PID: 6908 Comm: kbnepd bnep0 Tainted: G B 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/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:88 [inline] dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:114 dump_stack+0x1c/0x28 lib/dump_stack.c:123 ubsan_epilogue lib/ubsan.c:217 [inline] __ubsan_handle_out_of_bounds+0xf8/0x148 lib/ubsan.c:415 decode_tail kernel/locking/qspinlock.c:131 [inline] queued_spin_lock_slowpath+0x984/0xd38 kernel/locking/qspinlock.c:471 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x320/0x348 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:3970 [inline] device_for_each_child+0xc0/0x174 drivers/base/core.c:4048 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+0x117c/0x1770 net/core/dev.c:11129 unregister_netdevice_many net/core/dev.c:11157 [inline] unregister_netdevice_queue net/core/dev.c:11036 [inline] unregister_netdevice include/linux/netdevice.h:3115 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11175 bnep_session+0x23bc/0x257c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 ---[ end trace ]--- Unable to handle kernel paging request at virtual address ffff80008ede8ae0 KASAN: probably user-memory-access in range [0x0000000476f45700-0x0000000476f45707] 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=00000001ad5bd000 [ffff80008ede8ae0] pgd=0000000000000000, p4d=10000001b26f7003, pud=10000001b26f8003, pmd=10000001b26fc003, pte=0000000000000000 Internal error: Oops: 0000000096000047 [#1] PREEMPT SMP Modules linked in: CPU: 1 PID: 6908 Comm: kbnepd bnep0 Tainted: G B 6.9.0-rc4-syzkaller-g6a71d2909427 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 pstate: 804010c5 (Nzcv daIF +PAN -UAO -TCO -DIT +SSBS BTYPE=--) pc : queued_spin_lock_slowpath+0x3d4/0xd38 kernel/locking/qspinlock.c:474 lr : decode_tail kernel/locking/qspinlock.c:131 [inline] lr : queued_spin_lock_slowpath+0x984/0xd38 kernel/locking/qspinlock.c:471 sp : ffff800099417560 x29: ffff800099417600 x28: 000000000000c23a x27: 1ffff00013282eb8 x26: dfff800000000000 x25: 1fffe0001b156500 x24: 0000000000080000 x23: ffff0001b3e05ac8 x22: ffff80008ede8ae0 x21: ffff0001b3e05ac0 x20: 1fffe000367c0b58 x19: ffff0000d8ab2800 x18: 0000000000000008 x17: 0000000000000000 x16: ffff80008ae725bc x15: ffff7000124347f0 x14: 1ffff000124347f0 x13: 0000000000000004 x12: ffffffffffffffff x11: ffff7000124347f0 x10: ffff80008ede8ac0 x9 : 0000000000000002 x8 : 0000000000000000 x7 : 0000000000000001 x6 : 0000000000000001 x5 : ffff800099416c98 x4 : ffff80008ef650a0 x3 : ffff8000801ce878 x2 : 0000000000000001 x1 : 0000000000000004 x0 : ffff0001b3e05ac8 Call trace: queued_spin_lock_slowpath+0x3d4/0xd38 kernel/locking/qspinlock.c:477 queued_spin_lock include/asm-generic/qspinlock.h:114 [inline] do_raw_spin_lock+0x320/0x348 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:3970 [inline] device_for_each_child+0xc0/0x174 drivers/base/core.c:4048 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+0x117c/0x1770 net/core/dev.c:11129 unregister_netdevice_many net/core/dev.c:11157 [inline] unregister_netdevice_queue net/core/dev.c:11036 [inline] unregister_netdevice include/linux/netdevice.h:3115 [inline] unregister_netdev+0x180/0x1f8 net/core/dev.c:11175 bnep_session+0x23bc/0x257c net/bluetooth/bnep/core.c:525 kthread+0x288/0x310 kernel/kthread.c:388 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860 Code: aa1603e0 973edfc5 aa1703e0 52800081 (f90002d5) ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess): 0: aa1603e0 mov x0, x22 4: 973edfc5 bl 0xfffffffffcfb7f18 8: aa1703e0 mov x0, x23 c: 52800081 mov w1, #0x4 // #4 * 10: f90002d5 str x21, [x22] <-- trapping instruction