================================================================== BUG: KASAN: use-after-free in inode2sd+0x64f/0xa20 fs/reiserfs/inode.c:1364 Write of size 2 at addr ffff888059efe554 by task syz-executor389/13354 CPU: 0 UID: 0 PID: 13354 Comm: syz-executor389 Not tainted 6.12.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 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 inode2sd+0x64f/0xa20 fs/reiserfs/inode.c:1364 update_stat_data fs/reiserfs/inode.c:1425 [inline] reiserfs_update_sd_size+0xa68/0x10b0 fs/reiserfs/inode.c:1491 reiserfs_update_sd fs/reiserfs/reiserfs.h:3101 [inline] reiserfs_do_truncate+0xe3a/0x1500 fs/reiserfs/stree.c:2035 reiserfs_truncate_file+0x4c7/0x810 fs/reiserfs/inode.c:2301 reiserfs_setattr+0xbdd/0x1150 fs/reiserfs/inode.c:3385 notify_change+0xbca/0xe90 fs/attr.c:503 do_truncate+0x220/0x310 fs/open.c:65 handle_truncate fs/namei.c:3395 [inline] do_open fs/namei.c:3778 [inline] path_openat+0x2e1a/0x3590 fs/namei.c:3933 do_filp_open+0x235/0x490 fs/namei.c:3960 do_sys_openat2+0x13e/0x1d0 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_creat fs/open.c:1508 [inline] __se_sys_creat fs/open.c:1502 [inline] __x64_sys_creat+0x123/0x170 fs/open.c:1502 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x82/0x160 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fafcf360a99 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 c1 1b 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:00007fafcf30e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000055 RAX: ffffffffffffffda RBX: 00007fafcf3e26c8 RCX: 00007fafcf360a99 RDX: 00007fafcf360a99 RSI: 0000000000000000 RDI: 0000000020000940 RBP: 00007fafcf3e26c0 R08: 00007fafcf30e6c0 R09: 0000000000000000 R10: 00007fafcf30e6c0 R11: 0000000000000246 R12: 00007fafcf3e26cc R13: 0000000000000006 R14: 00007ffc329acd60 R15: 00007ffc329ace48 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x43 pfn:0x59efe flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffffea0001c5de08 ffffea0001c5f008 0000000000000000 raw: 0000000000000043 0000000000000001 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 13371, tgid 13355 (syz-executor389), ts 515764069555, free_ts 515774419151 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1ee/0x220 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x3a55/0x3cc0 mm/page_alloc.c:3457 __alloc_pages_noprof+0x261/0x6a0 mm/page_alloc.c:4733 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265 folio_alloc_mpol_noprof+0x36/0x50 mm/mempolicy.c:2283 shmem_alloc_folio mm/shmem.c:1769 [inline] shmem_alloc_and_add_folio+0x49b/0x13d0 mm/shmem.c:1808 shmem_get_folio_gfp+0x5a9/0x2090 mm/shmem.c:2330 shmem_get_folio mm/shmem.c:2436 [inline] shmem_write_begin+0x17e/0x460 mm/shmem.c:3041 generic_perform_write+0x345/0xbf0 mm/filemap.c:4054 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3216 new_sync_write fs/read_write.c:590 [inline] vfs_write+0xaeb/0xd30 fs/read_write.c:683 ksys_write+0x183/0x2b0 fs/read_write.c:736 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x82/0x160 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e page last free pid 13371 tgid 13355 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] free_unref_folios+0xed7/0x1870 mm/page_alloc.c:2686 folios_put_refs+0x76c/0x860 mm/swap.c:1007 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x64c/0x1ce0 mm/shmem.c:1032 shmem_truncate_range mm/shmem.c:1144 [inline] shmem_evict_inode+0x29e/0xa90 mm/shmem.c:1272 evict+0x4e8/0x9a0 fs/inode.c:725 __dentry_kill+0x200/0x610 fs/dcache.c:615 dput+0x19f/0x2b0 fs/dcache.c:857 __fput+0x5d2/0x880 fs/file_table.c:439 __do_sys_close fs/open.c:1567 [inline] __se_sys_close+0x15f/0x220 fs/open.c:1552 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x82/0x160 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e Memory state around the buggy address: ffff888059efe400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888059efe480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888059efe500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888059efe580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888059efe600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================