================================================================== BUG: KASAN: use-after-free in leaf_paste_in_buffer+0x63c/0xad0 fs/reiserfs/lbalance.c:-1 Read of size 48 at addr ffff888050752ff0 by task syz.2.147/5069 CPU: 1 PID: 5069 Comm: syz.2.147 Not tainted syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026 Call Trace: dump_stack_lvl+0x188/0x24e lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0xa8/0x210 mm/kasan/report.c:420 kasan_report+0x10b/0x140 mm/kasan/report.c:524 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x235/0x290 mm/kasan/generic.c:189 memcpy+0x25/0x60 mm/kasan/shadow.c:65 leaf_paste_in_buffer+0x63c/0xad0 fs/reiserfs/lbalance.c:-1 leaf_copy_dir_entries+0x56e/0x920 fs/reiserfs/lbalance.c:108 leaf_copy_boundary_item+0xba4/0x21e0 fs/reiserfs/lbalance.c:168 leaf_copy_items fs/reiserfs/lbalance.c:551 [inline] leaf_move_items+0x85f/0xe00 fs/reiserfs/lbalance.c:726 balance_leaf_when_delete_left fs/reiserfs/do_balan.c:167 [inline] balance_leaf_when_delete fs/reiserfs/do_balan.c:272 [inline] balance_leaf+0xc354/0x10ec0 fs/reiserfs/do_balan.c:1393 do_balance+0x318/0x930 fs/reiserfs/do_balan.c:1888 reiserfs_cut_from_item+0x146f/0x2000 fs/reiserfs/stree.c:1838 reiserfs_do_truncate+0x9b2/0x12f0 fs/reiserfs/stree.c:1973 reiserfs_truncate_file+0x486/0x7e0 fs/reiserfs/inode.c:2310 reiserfs_setattr+0xcb5/0x12c0 fs/reiserfs/inode.c:3395 notify_change+0xca0/0xf90 fs/attr.c:499 do_truncate+0x1ac/0x240 fs/open.c:65 do_sys_ftruncate+0x312/0x3c0 fs/open.c:193 do_syscall_x64 arch/x86/entry/common.c:46 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:76 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7f4c6af9e019 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4c6bdcc028 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f4c6b226090 RCX: 00007f4c6af9e019 RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000005 RBP: 00007f4c6b03500c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f4c6b226128 R14: 00007f4c6b226090 R15: 00007ffc405aa1f8 The buggy address belongs to the physical page: page:ffffea000141d480 refcount:2 mapcount:0 mapping:ffff888140c0e000 index:0x245 pfn:0x50752 memcg:ffff888028b86000 aops:def_blk_aops ino:700002 flags: 0xfff58000002052(referenced|lru|workingset|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff58000002052 ffffea0001503e88 ffffea0001449ec8 ffff888140c0e000 raw: 0000000000000245 ffff88805143d9f8 00000002ffffffff ffff888028b86000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 5048, tgid 5047 (syz.2.147), ts 130104956049, free_ts 129981926290 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2560 prep_new_page mm/page_alloc.c:2567 [inline] get_page_from_freelist+0x206b/0x2180 mm/page_alloc.c:4358 __alloc_pages+0x1ec/0x4f0 mm/page_alloc.c:5658 folio_alloc+0x1c/0x60 mm/mempolicy.c:2292 filemap_alloc_folio+0xdb/0x480 mm/filemap.c:999 __filemap_get_folio+0x6ba/0xde0 mm/filemap.c:1993 pagecache_get_page+0x26/0x260 mm/folio-compat.c:110 find_or_create_page include/linux/pagemap.h:648 [inline] grow_dev_page fs/buffer.c:946 [inline] grow_buffers fs/buffer.c:1011 [inline] __getblk_slow fs/buffer.c:1038 [inline] __getblk_gfp+0x2a0/0xa80 fs/buffer.c:1333 sb_getblk include/linux/buffer_head.h:356 [inline] get_empty_nodes+0x5ac/0x990 fs/reiserfs/fix_node.c:890 fix_nodes+0x38a4/0x8720 fs/reiserfs/fix_node.c:2662 reiserfs_paste_into_item+0x60b/0x7f0 fs/reiserfs/stree.c:2130 reiserfs_get_block+0x1c4a/0x4110 fs/reiserfs/inode.c:1069 __block_write_begin_int+0x577/0x1ab0 fs/buffer.c:1991 reiserfs_write_begin+0x1fa/0x490 fs/reiserfs/inode.c:2775 generic_perform_write+0x2fa/0x5c0 mm/filemap.c:3862 __generic_file_write_iter+0x148/0x2a0 mm/filemap.c:3960 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1487 [inline] free_pcp_prepare mm/page_alloc.c:1537 [inline] free_unref_page_prepare+0x8e5/0x9e0 mm/page_alloc.c:3414 free_unref_page_list+0xbb/0x8e0 mm/page_alloc.c:3555 release_pages+0x20d1/0x2340 mm/swap.c:1035 tlb_batch_pages_flush mm/mmu_gather.c:60 [inline] tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu+0x105/0x220 mm/mmu_gather.c:262 tlb_finish_mmu+0xf0/0x220 mm/mmu_gather.c:394 exit_mmap+0x388/0x970 mm/mmap.c:3262 __mmput+0x118/0x3a0 kernel/fork.c:1206 exit_mm+0x24d/0x350 kernel/exit.c:572 do_exit+0x958/0x2570 kernel/exit.c:874 do_group_exit+0x229/0x2e0 kernel/exit.c:1030 get_signal+0x1259/0x1340 kernel/signal.c:2880 arch_do_signal_or_restart+0xc4/0x1310 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x70/0x110 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x16/0x40 kernel/entry/common.c:303 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:82 Memory state around the buggy address: ffff888050752f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888050752f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888050753000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888050753080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888050753100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================