================================================================== BUG: KASAN: use-after-free in data_blkaddr fs/f2fs/f2fs.h:2699 [inline] BUG: KASAN: use-after-free in is_alive fs/f2fs/gc.c:1030 [inline] BUG: KASAN: use-after-free in gc_data_segment fs/f2fs/gc.c:1448 [inline] BUG: KASAN: use-after-free in do_garbage_collect+0x5b28/0x7160 fs/f2fs/gc.c:1653 Read of size 4 at addr ffff8881e1f45124 by task kworker/u4:1/6604 CPU: 1 PID: 6604 Comm: kworker/u4:1 Not tainted 5.4.210-syzkaller-00073-gd87b38e6be0f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: writeback wb_workfn (flush-7:2) Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18e/0x1d5 lib/dump_stack.c:118 print_address_description+0x8c/0x630 mm/kasan/report.c:384 __kasan_report+0xf6/0x130 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 data_blkaddr fs/f2fs/f2fs.h:2699 [inline] is_alive fs/f2fs/gc.c:1030 [inline] gc_data_segment fs/f2fs/gc.c:1448 [inline] do_garbage_collect+0x5b28/0x7160 fs/f2fs/gc.c:1653 f2fs_gc+0x872/0x17f0 fs/f2fs/gc.c:1745 f2fs_balance_fs+0x2c2/0x340 fs/f2fs/segment.c:528 f2fs_write_single_data_page+0xe65/0x1920 fs/f2fs/data.c:2868 f2fs_write_cache_pages fs/f2fs/data.c:3083 [inline] __f2fs_write_data_pages+0x15a6/0x2a30 fs/f2fs/data.c:3234 do_writepages+0xda/0x1f0 mm/page-writeback.c:2344 __writeback_single_inode+0xc5/0x840 fs/fs-writeback.c:1467 writeback_sb_inodes+0x9a9/0x19d0 fs/fs-writeback.c:1730 wb_writeback+0x3c2/0xc20 fs/fs-writeback.c:1905 wb_do_writeback+0x181/0xaf0 fs/fs-writeback.c:2050 wb_workfn+0xf8/0x450 fs/fs-writeback.c:2091 process_one_work+0x6ca/0xc40 kernel/workqueue.c:2287 worker_thread+0xae0/0x1440 kernel/workqueue.c:2433 kthread+0x2d8/0x360 kernel/kthread.c:288 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352 Allocated by task 155: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd0/0x210 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 do_sys_open+0x2a3/0x700 fs/open.c:1107 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 155: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kmem_cache_free+0xa9/0x1d0 mm/slub.c:3096 do_sys_open+0x59a/0x700 fs/open.c:1122 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881e1f44400 which belongs to the cache names_cache of size 4096 The buggy address is located 3364 bytes inside of 4096-byte region [ffff8881e1f44400, ffff8881e1f45400) The buggy address belongs to the page: page:ffffea000787d000 refcount:1 mapcount:0 mapping:ffff8881f5cf8000 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5cf8000 raw: 0000000000000000 0000000000070007 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x194/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857 alloc_slab_page+0x39/0x3e0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x97/0x450 mm/slub.c:1749 new_slab_objects mm/slub.c:2505 [inline] ___slab_alloc+0x320/0x4a0 mm/slub.c:2667 __slab_alloc+0x5a/0x90 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0x100/0x210 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 do_sys_open+0x2a3/0x700 fs/open.c:1107 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x7ee/0x920 mm/page_alloc.c:1438 free_the_page mm/page_alloc.c:4919 [inline] __free_pages+0x45/0x1e0 mm/page_alloc.c:4925 __free_slab+0x22b/0x2e0 mm/slub.c:1774 __slab_free+0x362/0x370 mm/slub.c:3012 qlist_free_all+0x4c/0xb0 mm/kasan/quarantine.c:167 quarantine_reduce+0x174/0x190 mm/kasan/quarantine.c:260 __kasan_kmalloc+0x43/0x1e0 mm/kasan/common.c:507 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xd0/0x210 mm/slub.c:2842 getname_flags+0xb8/0x4e0 fs/namei.c:141 user_path_at_empty+0x28/0x50 fs/namei.c:2683 user_path_at include/linux/namei.h:49 [inline] vfs_statx+0xd2/0x1a0 fs/stat.c:187 vfs_fstatat include/linux/fs.h:3367 [inline] __do_sys_newfstatat fs/stat.c:367 [inline] __se_sys_newfstatat+0x60/0x6e0 fs/stat.c:361 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff8881e1f45000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e1f45080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e1f45100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e1f45180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e1f45200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================