Bluetooth: hci2: Opcode 0x0c1a failed: -4 Bluetooth: hci2: Error when powering off device on rfkill (-4) ================================================================== BUG: KASAN: use-after-free in __list_del_entry_valid_or_report+0x1d4/0x200 lib/list_debug.c:62 Read of size 8 at addr ffff8880335d7570 by task syz.5.1768/11832 CPU: 2 UID: 0 PID: 11832 Comm: syz.5.1768 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 __list_del_entry_valid_or_report+0x1d4/0x200 lib/list_debug.c:62 __list_del_entry_valid include/linux/list.h:132 [inline] __list_del_entry include/linux/list.h:223 [inline] list_del_init include/linux/list.h:295 [inline] bt_accept_unlink+0x34/0x2d0 net/bluetooth/af_bluetooth.c:259 l2cap_sock_teardown_cb+0x1a3/0x3c0 net/bluetooth/l2cap_sock.c:1616 l2cap_chan_del+0xbd/0x8f0 net/bluetooth/l2cap_core.c:656 l2cap_conn_del+0x37a/0x730 net/bluetooth/l2cap_core.c:1788 l2cap_disconn_cfm net/bluetooth/l2cap_core.c:7326 [inline] l2cap_disconn_cfm+0x96/0xd0 net/bluetooth/l2cap_core.c:7319 hci_disconn_cfm include/net/bluetooth/hci_core.h:2129 [inline] hci_conn_hash_flush+0x10e/0x260 net/bluetooth/hci_conn.c:2614 hci_dev_close_sync+0x602/0x11d0 net/bluetooth/hci_sync.c:5308 hci_dev_do_close+0x2e/0x90 net/bluetooth/hci_core.c:501 hci_rfkill_set_block+0x225/0x360 net/bluetooth/hci_core.c:929 rfkill_set_block+0x1fe/0x550 net/rfkill/core.c:346 rfkill_fop_write+0x2c0/0x580 net/rfkill/core.c:1301 vfs_write+0x2a0/0x11d0 fs/read_write.c:684 ksys_write+0x1f8/0x250 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f65bf98f7c9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f65c08ce038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f65bfbe5fa0 RCX: 00007f65bf98f7c9 RDX: 0000000000000008 RSI: 0000200000000000 RDI: 0000000000000004 RBP: 00007f65bfa13f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f65bfbe6038 R14: 00007f65bfbe5fa0 R15: 00007ffe923f61a8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x200000a1f pfn:0x335d7 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000200000a1f 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x140dc2(GFP_HIGHUSER|__GFP_ZERO|__GFP_COMP), pid 11735, tgid 11734 (syz.4.1732), ts 166413990773, free_ts 166514180954 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1af/0x220 mm/page_alloc.c:1845 prep_new_page mm/page_alloc.c:1853 [inline] get_page_from_freelist+0x10a3/0x3a30 mm/page_alloc.c:3879 __alloc_frozen_pages_noprof+0x25f/0x2470 mm/page_alloc.c:5178 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2416 folio_alloc_mpol_noprof+0x36/0x2f0 mm/mempolicy.c:2435 vma_alloc_folio_noprof+0xed/0x1e0 mm/mempolicy.c:2470 folio_prealloc mm/memory.c:1190 [inline] alloc_anon_folio mm/memory.c:5126 [inline] do_anonymous_page mm/memory.c:5183 [inline] do_pte_missing+0x2202/0x3ba0 mm/memory.c:4360 handle_pte_fault mm/memory.c:6195 [inline] __handle_mm_fault+0x1556/0x2aa0 mm/memory.c:6336 handle_mm_fault+0x589/0xd10 mm/memory.c:6505 faultin_page mm/gup.c:1126 [inline] __get_user_pages+0x54e/0x3530 mm/gup.c:1428 __get_user_pages_locked mm/gup.c:1692 [inline] __gup_longterm_locked+0x2dd/0x17e0 mm/gup.c:2481 gup_fast_fallback+0xee2/0x22a0 mm/gup.c:3220 pin_user_pages_fast+0xa7/0xf0 mm/gup.c:3326 pfn_reader_user_pin+0xcd0/0x10b0 drivers/iommu/iommufd/pages.c:909 iopt_pages_fill drivers/iommu/iommufd/pages.c:1827 [inline] iopt_pages_fill_xarray+0x3b5/0xa20 drivers/iommu/iommufd/pages.c:1894 iopt_area_add_access+0x22a/0x410 drivers/iommu/iommufd/pages.c:2143 page last free pid 11734 tgid 11734 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] free_unref_folios+0xa31/0x1610 mm/page_alloc.c:2958 folios_put_refs+0x4be/0x750 mm/swap.c:1002 free_pages_and_swap_cache+0x245/0x4a0 mm/swap_state.c:355 __tlb_batch_free_encoded_pages+0xf9/0x290 mm/mmu_gather.c:136 tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:397 [inline] tlb_flush_mmu+0xe9/0x5a0 mm/mmu_gather.c:404 zap_pte_range mm/memory.c:1894 [inline] zap_pmd_range mm/memory.c:1947 [inline] zap_pud_range mm/memory.c:1976 [inline] zap_p4d_range mm/memory.c:1997 [inline] unmap_page_range+0x1f1e/0x41b0 mm/memory.c:2018 unmap_single_vma.constprop.0+0x153/0x240 mm/memory.c:2061 unmap_vmas+0x218/0x470 mm/memory.c:2105 exit_mmap+0x1b2/0xb90 mm/mmap.c:1280 __mmput+0x12a/0x410 kernel/fork.c:1133 mmput+0x62/0x70 kernel/fork.c:1156 exit_mm kernel/exit.c:582 [inline] do_exit+0x7c7/0x2bf0 kernel/exit.c:954 do_group_exit+0xd3/0x2a0 kernel/exit.c:1107 __do_sys_exit_group kernel/exit.c:1118 [inline] __se_sys_exit_group kernel/exit.c:1116 [inline] __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1116 x64_sys_call+0x150b/0x1730 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xfa0 arch/x86/entry/syscall_64.c:94 Memory state around the buggy address: ffff8880335d7400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880335d7480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880335d7500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880335d7580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880335d7600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================