================================================================== BUG: KASAN: slab-use-after-free in device_for_each_child+0xac/0x180 drivers/base/core.c:3996 Read of size 8 at addr ffff0000c2485308 by task kbnepd bnep0/6572 CPU: 0 UID: 0 PID: 6572 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 6433: 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 7178: 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 get_signal+0x1410/0x152c kernel/signal.c:2918 do_signal+0x1b0/0x391c arch/arm64/kernel/signal.c:1645 do_notify_resume+0x74/0x1f4 arch/arm64/kernel/entry-common.c:148 exit_to_user_mode_prepare arch/arm64/kernel/entry-common.c:169 [inline] exit_to_user_mode arch/arm64/kernel/entry-common.c:178 [inline] el0_da+0xbc/0x178 arch/arm64/kernel/entry-common.c:605 el0t_64_sync_handler+0xcc/0x108 arch/arm64/kernel/entry-common.c:765 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+0xe20/0x1308 kernel/workqueue.c:2339 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2390 queue_work include/linux/workqueue.h:662 [inline] hci_send_acl+0x768/0xa50 net/bluetooth/hci_core.c:3242 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:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_sendmsg net/socket.c:767 [inline] kernel_sendmsg+0x1d0/0x2e4 net/socket.c:791 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: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 queue_work_on+0xe0/0x1a0 kernel/workqueue.c:2390 queue_work include/linux/workqueue.h:662 [inline] hci_send_acl+0x768/0xa50 net/bluetooth/hci_core.c:3242 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:729 [inline] __sock_sendmsg net/socket.c:744 [inline] sock_sendmsg net/socket.c:767 [inline] kernel_sendmsg+0x1d0/0x2e4 net/socket.c:791 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:862 The buggy address belongs to the object at ffff0000c2484000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 4872 bytes inside of freed 8192-byte region [ffff0000c2484000, ffff0000c2486000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x102480 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 fffffdffc3092001 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c2485200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c2485280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c2485300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c2485380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff0000c2485400: 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 12708 is out of range for type 'unsigned long[8]' CPU: 0 UID: 0 PID: 6572 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 ]---