loop1: rw=1048577, sector=77824, nr_sectors = 3224 limit=40427 kworker/u17:3: attempt to access beyond end of device loop1: rw=1048577, sector=81048, nr_sectors = 872 limit=40427 ================================================================== BUG: KASAN: use-after-free in rb_link_node include/linux/rbtree.h:65 [inline] BUG: KASAN: use-after-free in __attach_extent_node+0x50b/0x620 fs/f2fs/extent_cache.c:372 Write of size 8 at addr ffff8880453c91a8 by task kworker/u17:3/58 CPU: 0 PID: 58 Comm: kworker/u17:3 Not tainted 6.2.0-rc7-syzkaller-00199-g420b2d431d18 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Workqueue: writeback wb_workfn (flush-7:1) Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 rb_link_node include/linux/rbtree.h:65 [inline] __attach_extent_node+0x50b/0x620 fs/f2fs/extent_cache.c:372 __insert_extent_tree+0x1d6/0x670 fs/f2fs/extent_cache.c:655 __update_extent_tree_range+0x14ce/0x1740 fs/f2fs/extent_cache.c:795 __update_extent_cache+0x588/0x740 fs/f2fs/extent_cache.c:962 f2fs_outplace_write_data+0x1eb/0x280 fs/f2fs/segment.c:3453 f2fs_do_write_data_page+0x9c7/0x1e20 fs/f2fs/data.c:2745 f2fs_write_single_data_page+0x13f0/0x1920 fs/f2fs/data.c:2863 f2fs_write_cache_pages+0xaa8/0x2010 fs/f2fs/data.c:3115 __f2fs_write_data_pages fs/f2fs/data.c:3265 [inline] f2fs_write_data_pages+0xca8/0x1230 fs/f2fs/data.c:3292 do_writepages+0x1af/0x690 mm/page-writeback.c:2581 __writeback_single_inode+0x159/0x1440 fs/fs-writeback.c:1598 writeback_sb_inodes+0x54d/0xf90 fs/fs-writeback.c:1889 __writeback_inodes_wb+0xc6/0x280 fs/fs-writeback.c:1960 wb_writeback+0x8d6/0xd70 fs/fs-writeback.c:2065 wb_check_background_flush fs/fs-writeback.c:2131 [inline] wb_do_writeback fs/fs-writeback.c:2219 [inline] wb_workfn+0xa16/0x12f0 fs/fs-writeback.c:2246 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 Allocated by task 8119: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x82/0x90 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x1e4/0x430 mm/slub.c:3476 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2796 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2806 [inline] __grab_extent_tree+0x278/0x5a0 fs/f2fs/extent_cache.c:423 f2fs_init_extent_tree+0x57/0x80 fs/f2fs/extent_cache.c:533 f2fs_new_inode+0xdfa/0x2760 fs/f2fs/namei.c:312 __f2fs_tmpfile+0xba/0x440 fs/f2fs/namei.c:852 f2fs_ioc_start_atomic_write+0x409/0x1260 fs/f2fs/file.c:2098 __f2fs_ioctl+0x3f2a/0xaaf0 fs/f2fs/file.c:4150 f2fs_compat_ioctl+0x399/0x630 fs/f2fs/file.c:4867 __do_compat_sys_ioctl+0x255/0x2b0 fs/ioctl.c:968 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 8119: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x40 mm/kasan/generic.c:518 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1807 slab_free mm/slub.c:3787 [inline] kmem_cache_free+0xee/0x5c0 mm/slub.c:3809 __destroy_extent_tree+0x1f8/0x7f0 fs/f2fs/extent_cache.c:1193 f2fs_destroy_extent_tree+0x17/0x30 fs/f2fs/extent_cache.c:1204 f2fs_evict_inode+0x38b/0x1df0 fs/f2fs/inode.c:789 evict+0x2ed/0x6b0 fs/inode.c:664 iput_final fs/inode.c:1747 [inline] iput.part.0+0x59b/0x880 fs/inode.c:1773 iput+0x5c/0x80 fs/inode.c:1763 f2fs_abort_atomic_write+0xea/0x4f0 fs/f2fs/segment.c:196 f2fs_release_file+0xc8/0xf0 fs/f2fs/file.c:1869 __fput+0x27c/0xa90 fs/file_table.c:320 task_work_run+0x16f/0x270 kernel/task_work.c:179 get_signal+0x1c7/0x2450 kernel/signal.c:2635 arch_do_signal_or_restart+0x79/0x5c0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop kernel/entry/common.c:168 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x1d/0x50 kernel/entry/common.c:296 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff8880453c91a0 which belongs to the cache f2fs_extent_tree of size 144 The buggy address is located 8 bytes inside of 144-byte region [ffff8880453c91a0, ffff8880453c9230) The buggy address belongs to the physical page: page:ffffea000114f240 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880453c9000 pfn:0x453c9 flags: 0x4fff00000000200(slab|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000200 ffff888012eac640 dead000000000122 0000000000000000 raw: ffff8880453c9000 0000000080130012 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x112c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 8024, tgid 8022 (syz-executor.2), ts 264169852677, free_ts 262949009715 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2287 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab+0x25f/0x350 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x379/0x430 mm/slub.c:3476 f2fs_kmem_cache_alloc_nofail fs/f2fs/f2fs.h:2796 [inline] f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:2806 [inline] __grab_extent_tree+0x278/0x5a0 fs/f2fs/extent_cache.c:423 f2fs_init_extent_tree+0x57/0x80 fs/f2fs/extent_cache.c:533 f2fs_new_inode+0xdfa/0x2760 fs/f2fs/namei.c:312 f2fs_create+0x1db/0x670 fs/f2fs/namei.c:353 lookup_open.isra.0+0xee7/0x1270 fs/namei.c:3413 open_last_lookups fs/namei.c:3481 [inline] path_openat+0x975/0x2a50 fs/namei.c:3711 do_filp_open+0x1ba/0x410 fs/namei.c:3741 do_sys_openat2+0x16d/0x4c0 fs/open.c:1310 do_sys_open fs/open.c:1326 [inline] __do_sys_creat fs/open.c:1402 [inline] __se_sys_creat fs/open.c:1396 [inline] __ia32_sys_creat+0xcc/0x120 fs/open.c:1396 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3464 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2637 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x66/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slub.c:3452 [inline] slab_alloc mm/slub.c:3460 [inline] __kmem_cache_alloc_lru mm/slub.c:3467 [inline] kmem_cache_alloc+0x1e4/0x430 mm/slub.c:3476 kmem_cache_zalloc include/linux/slab.h:710 [inline] lsm_inode_alloc security/security.c:624 [inline] security_inode_alloc+0x38/0x160 security/security.c:1054 inode_init_always+0xbfa/0xef0 fs/inode.c:230 alloc_inode+0x82/0x230 fs/inode.c:266 new_inode_pseudo fs/inode.c:1018 [inline] new_inode+0x2b/0x280 fs/inode.c:1046 __ext4_new_inode+0x399/0x57d0 fs/ext4/ialloc.c:959 ext4_symlink+0x5ac/0xa00 fs/ext4/namei.c:3373 vfs_symlink fs/namei.c:4401 [inline] vfs_symlink+0x369/0x5c0 fs/namei.c:4386 do_symlinkat+0x250/0x2c0 fs/namei.c:4430 __do_sys_symlinkat fs/namei.c:4447 [inline] __se_sys_symlinkat fs/namei.c:4444 [inline] __ia32_sys_symlinkat+0x97/0xc0 fs/namei.c:4444 Memory state around the buggy address: ffff8880453c9080: fb fb fc fc fc fc fc fc fc fc 00 00 00 00 00 00 ffff8880453c9100: 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc >ffff8880453c9180: fc fc fc fc fa fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880453c9200: fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc ffff8880453c9280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================