BTRFS info (device loop3 state EA): last unmount of filesystem c9fe44da-de57-406a-8241-57ec7d4412cf
==================================================================
BUG: KASAN: slab-use-after-free in rb_left_deepest_node lib/rbtree.c:595 [inline]
BUG: KASAN: slab-use-after-free in rb_first_postorder+0x69/0x90 lib/rbtree.c:628
Read of size 8 at addr ffff88802429f010 by task syz-executor/5224

CPU: 1 UID: 0 PID: 5224 Comm: syz-executor Not tainted 6.11.0-syzkaller-07462-g1868f9d0260e #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:93 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:119
 print_address_description mm/kasan/report.c:377 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:488
 kasan_report+0x143/0x180 mm/kasan/report.c:601
 rb_left_deepest_node lib/rbtree.c:595 [inline]
 rb_first_postorder+0x69/0x90 lib/rbtree.c:628
 btrfs_cleanup_defrag_inodes+0x2f/0x80 fs/btrfs/defrag.c:212
 close_ctree+0x2af/0xd20 fs/btrfs/disk-io.c:4256
 generic_shutdown_super+0x139/0x2d0 fs/super.c:642
 kill_anon_super+0x3b/0x70 fs/super.c:1237
 btrfs_kill_super+0x41/0x50 fs/btrfs/super.c:2121
 deactivate_locked_super+0xc4/0x130 fs/super.c:473
 cleanup_mnt+0x41f/0x4b0 fs/namespace.c:1373
 task_work_run+0x24f/0x310 kernel/task_work.c:228
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0xa2f/0x27f0 kernel/exit.c:882
 do_group_exit+0x207/0x2c0 kernel/exit.c:1031
 __do_sys_exit_group kernel/exit.c:1042 [inline]
 __se_sys_exit_group kernel/exit.c:1040 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040
 x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fbc1d37def9
Code: Unable to access opcode bytes at 0x7fbc1d37decf.
RSP: 002b:00007fff183f1c28 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007fbc1d3f0a86 RCX: 00007fbc1d37def9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000010 R08: 00007fff183ef9c6 R09: 00007fff183f2ee0
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff183f2ee0
R13: 00007fbc1d3f0a14 R14: 0000555556d444a8 R15: 00007fff183f3fa0
 </TASK>

Allocated by task 35:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 unpoison_slab_object mm/kasan/common.c:319 [inline]
 __kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:345
 kasan_slab_alloc include/linux/kasan.h:247 [inline]
 slab_post_alloc_hook mm/slub.c:4086 [inline]
 slab_alloc_node mm/slub.c:4135 [inline]
 kmem_cache_alloc_noprof+0x135/0x2a0 mm/slub.c:4142
 btrfs_add_inode_defrag+0x15c/0x790 fs/btrfs/defrag.c:136
 inode_should_defrag fs/btrfs/inode.c:888 [inline]
 cow_file_range+0x380/0x11f0 fs/btrfs/inode.c:1382
 fallback_to_cow+0x629/0xa80 fs/btrfs/inode.c:1857
 run_delalloc_nocow+0xe8a/0x11e0 fs/btrfs/inode.c:2253
 btrfs_run_delalloc_range+0x31d/0xf70 fs/btrfs/inode.c:2321
 writepage_delalloc+0x482/0x7d0 fs/btrfs/extent_io.c:1192
 extent_writepage fs/btrfs/extent_io.c:1454 [inline]
 extent_write_cache_pages fs/btrfs/extent_io.c:2130 [inline]
 btrfs_writepages+0x1157/0x2370 fs/btrfs/extent_io.c:2261
 do_writepages+0x35d/0x870 mm/page-writeback.c:2683
 __writeback_single_inode+0x14f/0x10d0 fs/fs-writeback.c:1658
 writeback_sb_inodes+0x812/0x1370 fs/fs-writeback.c:1954
 wb_writeback+0x41b/0xbd0 fs/fs-writeback.c:2134
 wb_do_writeback fs/fs-writeback.c:2281 [inline]
 wb_workfn+0x410/0x1090 fs/fs-writeback.c:2321
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244

Freed by task 5352:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:2343 [inline]
 slab_free mm/slub.c:4580 [inline]
 kmem_cache_free+0x1a3/0x420 mm/slub.c:4682
 btrfs_cleanup_defrag_inodes+0x51/0x80 fs/btrfs/defrag.c:214
 btrfs_remount_cleanup fs/btrfs/super.c:1263 [inline]
 btrfs_reconfigure+0x269c/0x2d40 fs/btrfs/super.c:1555
 reconfigure_super+0x445/0x880 fs/super.c:1083
 do_remount fs/namespace.c:3047 [inline]
 path_mount+0xc22/0xfa0 fs/namespace.c:3826
 do_mount fs/namespace.c:3847 [inline]
 __do_sys_mount fs/namespace.c:4055 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4032
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88802429f000
 which belongs to the cache btrfs_inode_defrag of size 56
The buggy address is located 16 bytes inside of
 freed 56-byte region [ffff88802429f000, ffff88802429f038)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2429f
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xfdffffff(slab)
raw: 00fff00000000000 ffff88814d07e000 dead000000000122 0000000000000000
raw: 0000000000000000 00000000802e002e 00000001fdffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 35, tgid 35 (kworker/u8:2), ts 78748663668, free_ts 78745105396
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1500
 prep_new_page mm/page_alloc.c:1508 [inline]
 get_page_from_freelist+0x2e4c/0x2f10 mm/page_alloc.c:3446
 __alloc_pages_noprof+0x256/0x6c0 mm/page_alloc.c:4702
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2263
 alloc_slab_page+0x6a/0x130 mm/slub.c:2413
 allocate_slab+0x5a/0x2f0 mm/slub.c:2579
 new_slab mm/slub.c:2632 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3819
 __slab_alloc+0x58/0xa0 mm/slub.c:3909
 __slab_alloc_node mm/slub.c:3962 [inline]
 slab_alloc_node mm/slub.c:4123 [inline]
 kmem_cache_alloc_noprof+0x1c1/0x2a0 mm/slub.c:4142
 btrfs_add_inode_defrag+0x15c/0x790 fs/btrfs/defrag.c:136
 inode_should_defrag fs/btrfs/inode.c:888 [inline]
 cow_file_range+0x380/0x11f0 fs/btrfs/inode.c:1382
 fallback_to_cow+0x629/0xa80 fs/btrfs/inode.c:1857
 run_delalloc_nocow+0xe8a/0x11e0 fs/btrfs/inode.c:2253
 btrfs_run_delalloc_range+0x31d/0xf70 fs/btrfs/inode.c:2321
 writepage_delalloc+0x482/0x7d0 fs/btrfs/extent_io.c:1192
 extent_writepage fs/btrfs/extent_io.c:1454 [inline]
 extent_write_cache_pages fs/btrfs/extent_io.c:2130 [inline]
 btrfs_writepages+0x1157/0x2370 fs/btrfs/extent_io.c:2261
page last free pid 35 tgid 35 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 free_pages_prepare mm/page_alloc.c:1101 [inline]
 free_unref_page+0xd19/0xea0 mm/page_alloc.c:2619
 rcu_do_batch kernel/rcu/tree.c:2567 [inline]
 rcu_core+0xaaa/0x17a0 kernel/rcu/tree.c:2823
 handle_softirqs+0x2c5/0x980 kernel/softirq.c:554
 __do_softirq kernel/softirq.c:588 [inline]
 invoke_softirq kernel/softirq.c:428 [inline]
 __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1037 [inline]
 sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1037
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702

Memory state around the buggy address:
 ffff88802429ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88802429ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88802429f000: fa fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc
                         ^
 ffff88802429f080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88802429f100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================