================================================================== BUG: KASAN: use-after-free in leaf_paste_in_buffer+0x635/0xab0 Read of size 48 at addr ffff8880549afff0 by task syz-executor.2/18668 CPU: 1 PID: 18668 Comm: syz-executor.2 Not tainted 6.7.0-rc6-syzkaller-00010-g2cf4f94d8e86 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x142/0x170 mm/kasan/report.c:588 kasan_check_range+0x27e/0x290 mm/kasan/generic.c:187 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 leaf_paste_in_buffer+0x635/0xab0 leaf_copy_dir_entries+0x71e/0xc60 fs/reiserfs/lbalance.c:108 leaf_copy_boundary_item+0xbbe/0x21b0 fs/reiserfs/lbalance.c:168 leaf_copy_items fs/reiserfs/lbalance.c:551 [inline] leaf_move_items+0xd1a/0x2960 fs/reiserfs/lbalance.c:726 leaf_shift_left+0xbe/0x430 fs/reiserfs/lbalance.c:750 balance_leaf+0x15d1/0x12510 fs/reiserfs/do_balan.c:1409 do_balance+0x30d/0x8f0 fs/reiserfs/do_balan.c:1888 reiserfs_insert_item+0xace/0xc30 fs/reiserfs/stree.c:2260 reiserfs_new_inode+0x1177/0x1cb0 fs/reiserfs/inode.c:2048 reiserfs_mkdir+0x5b0/0x8f0 fs/reiserfs/namei.c:843 vfs_mkdir+0x2f1/0x4b0 fs/namei.c:4106 do_mkdirat+0x264/0x3a0 fs/namei.c:4129 __do_sys_mkdir fs/namei.c:4149 [inline] __se_sys_mkdir fs/namei.c:4147 [inline] __x64_sys_mkdir+0x6e/0x80 fs/namei.c:4147 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x45/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b RIP: 0033:0x7fad0d27cbe9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fad0df8d0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000053 RAX: ffffffffffffffda RBX: 00007fad0d39bf80 RCX: 00007fad0d27cbe9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000000 RBP: 00007fad0d2c847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007fad0d39bf80 R15: 00007ffd28ca9198 The buggy address belongs to the physical page: page:ffffea0001526bc0 refcount:3 mapcount:0 mapping:ffff88801b08c1f8 index:0x214 pfn:0x549af memcg:ffff888018b94000 aops:def_blk_aops ino:700002 flags: 0xfff00000008104(referenced|active|private|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000008104 0000000000000000 dead000000000122 ffff88801b08c1f8 raw: 0000000000000214 ffff8880562d1000 00000003ffffffff ffff888018b94000 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 18668, tgid 18667 (syz-executor.2), ts 817197776295, free_ts 817189632991 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1544 [inline] get_page_from_freelist+0x33ea/0x3570 mm/page_alloc.c:3312 __alloc_pages+0x255/0x680 mm/page_alloc.c:4568 alloc_pages_mpol+0x3de/0x640 mm/mempolicy.c:2133 alloc_pages mm/mempolicy.c:2204 [inline] folio_alloc+0x12a/0x330 mm/mempolicy.c:2211 filemap_alloc_folio+0xde/0x500 mm/filemap.c:974 __filemap_get_folio+0x431/0xbb0 mm/filemap.c:1918 grow_dev_page fs/buffer.c:1041 [inline] grow_buffers fs/buffer.c:1106 [inline] __getblk_slow fs/buffer.c:1133 [inline] bdev_getblk+0x243/0x6d0 fs/buffer.c:1429 __getblk include/linux/buffer_head.h:358 [inline] sb_getblk include/linux/buffer_head.h:364 [inline] get_empty_nodes+0x716/0xd90 fs/reiserfs/fix_node.c:890 fix_nodes+0x261b/0x8ce0 fs/reiserfs/fix_node.c:2663 reiserfs_insert_item+0x9ea/0xc30 fs/reiserfs/stree.c:2239 reiserfs_new_directory+0x5c5/0x9a0 fs/reiserfs/inode.c:1840 reiserfs_new_inode+0x1238/0x1cb0 fs/reiserfs/inode.c:2062 reiserfs_mkdir+0x5b0/0x8f0 fs/reiserfs/namei.c:843 vfs_mkdir+0x2f1/0x4b0 fs/namei.c:4106 do_mkdirat+0x264/0x3a0 fs/namei.c:4129 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1137 [inline] free_unref_page_prepare+0x931/0xa60 mm/page_alloc.c:2347 free_unref_page_list+0x5a0/0x840 mm/page_alloc.c:2533 release_pages+0x2117/0x2400 mm/swap.c:1042 __folio_batch_release+0x84/0x100 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] truncate_inode_pages_range+0x457/0xf70 mm/truncate.c:371 truncate_inode_pages mm/truncate.c:448 [inline] truncate_pagecache mm/truncate.c:741 [inline] truncate_setsize+0xcf/0xf0 mm/truncate.c:766 reiserfs_setattr+0xbbc/0x1140 fs/reiserfs/inode.c:3387 notify_change+0xb99/0xe60 fs/attr.c:499 do_truncate+0x220/0x300 fs/open.c:66 do_sys_ftruncate+0x2f3/0x390 fs/open.c:194 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x45/0x110 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x63/0x6b Memory state around the buggy address: ffff8880549aff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880549aff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880549b0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880549b0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880549b0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================