================================================================== BUG: KASAN: use-after-free in device_for_each_child+0x17a/0x190 drivers/base/core.c:4044 Read of size 8 at addr ffff88806faf95f8 by task kbnepd bnep0/10117 CPU: 1 PID: 10117 Comm: kbnepd bnep0 Not tainted 6.9.0-rc6-syzkaller-00046-g18daea77cca6 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 device_for_each_child+0x17a/0x190 drivers/base/core.c:4044 pm_runtime_set_memalloc_noio+0xf2/0x180 drivers/base/power/runtime.c:248 netdev_unregister_kobject+0x1ed/0x270 net/core/net-sysfs.c:2106 unregister_netdevice_many_notify+0xc8a/0x19f0 net/core/dev.c:11135 unregister_netdevice_many net/core/dev.c:11163 [inline] unregister_netdevice_queue+0x307/0x3f0 net/core/dev.c:11042 unregister_netdevice include/linux/netdevice.h:3115 [inline] unregister_netdev+0x1c/0x30 net/core/dev.c:11181 bnep_session+0x1fc4/0x2aa0 net/bluetooth/bnep/core.c:525 kthread+0x2c1/0x3a0 kernel/kthread.c:388 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x400000000 pfn:0x6faf9 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 04fff00000000000 0000000000000000 ffffea0001bebe48 0000000000000000 raw: 0000000400000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x140dc0(GFP_USER|__GFP_COMP|__GFP_ZERO), pid 8854, tgid -197572706 (syz-executor.1), ts 8854, free_ts 228291350707 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d4/0x350 mm/page_alloc.c:1534 prep_new_page mm/page_alloc.c:1541 [inline] get_page_from_freelist+0xa28/0x3780 mm/page_alloc.c:3317 __alloc_pages+0x22b/0x2460 mm/page_alloc.c:4575 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] __kmalloc_large_node+0x7f/0x1a0 mm/slub.c:3911 __do_kmalloc_node mm/slub.c:3954 [inline] __kmalloc.cold+0xc/0x61 mm/slub.c:3979 kmalloc include/linux/slab.h:632 [inline] kzalloc include/linux/slab.h:749 [inline] hci_alloc_dev_priv+0x1d/0x2810 net/bluetooth/hci_core.c:2500 hci_alloc_dev include/net/bluetooth/hci_core.h:1674 [inline] __vhci_create_device+0xf7/0x820 drivers/bluetooth/hci_vhci.c:406 vhci_create_device drivers/bluetooth/hci_vhci.c:480 [inline] vhci_get_user drivers/bluetooth/hci_vhci.c:537 [inline] vhci_write+0x2c7/0x470 drivers/bluetooth/hci_vhci.c:617 call_write_iter include/linux/fs.h:2110 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0x6db/0x1100 fs/read_write.c:590 ksys_write+0x12f/0x260 fs/read_write.c:643 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x75/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e page last free pid 8854 tgid 8854 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1141 [inline] free_unref_page_prepare+0x527/0xb10 mm/page_alloc.c:2347 free_unref_page+0x33/0x3c0 mm/page_alloc.c:2487 __folio_put_large mm/swap.c:132 [inline] __folio_put+0x210/0x290 mm/swap.c:140 hci_release_dev+0x525/0x660 net/bluetooth/hci_core.c:2833 bt_host_release+0x6a/0xb0 net/bluetooth/hci_sysfs.c:94 device_release+0xa1/0x240 drivers/base/core.c:2580 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1fa/0x5b0 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3828 vhci_release+0x87/0x100 drivers/bluetooth/hci_vhci.c:675 __fput+0x270/0xb80 fs/file_table.c:422 task_work_run+0x14e/0x250 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xa7d/0x2c10 kernel/exit.c:878 do_group_exit+0xd3/0x2a0 kernel/exit.c:1027 get_signal+0x25c3/0x2670 kernel/signal.c:2911 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x14a/0x2a0 kernel/entry/common.c:218 Memory state around the buggy address: ffff88806faf9480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806faf9500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88806faf9580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88806faf9600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806faf9680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================