==================================================================
BUG: KASAN: slab-use-after-free in xlog_cil_push_work+0xa5a/0x2b10
Write of size 8 at addr ffff8881aa68e6f8 by task kworker/u10:1/37

CPU: 1 UID: 0 PID: 37 Comm: kworker/u10:1 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: xfs-cil/loop6 xlog_cil_push_work
Call Trace:
 <TASK>
 dump_stack_lvl+0xe8/0x150
 print_report+0xba/0x230
 kasan_report+0x117/0x150
 xlog_cil_push_work+0xa5a/0x2b10
 process_scheduled_works+0xb5d/0x1860
 worker_thread+0xa53/0xfc0
 kthread+0x388/0x470
 ret_from_fork+0x514/0xb70
 ret_from_fork_asm+0x1a/0x30
 </TASK>

Allocated by task 8539:
 kasan_save_track+0x3e/0x80
 __kasan_slab_alloc+0x6c/0x80
 kmem_cache_alloc_noprof+0x2bc/0x650
 xfs_buf_item_init+0x6a/0x6d0
 _xfs_trans_bjoin+0x46/0x110
 xfs_trans_read_buf_map+0x294/0x8f0
 xfs_btree_read_buf_block+0x2b0/0x490
 xfs_btree_lookup_get_block+0x297/0x510
 xfs_btree_lookup+0x45a/0x1350
 xfs_alloc_fixup_trees+0x219/0xd30
 xfs_alloc_cur_finish+0xd5/0x4a0
 xfs_alloc_ag_vextent_near+0xd70/0x1280
 xfs_alloc_vextent_iterate_ags+0x640/0x950
 xfs_alloc_vextent_start_ag+0x378/0x850
 xfs_bmapi_allocate+0x17c1/0x2da0
 xfs_bmapi_write+0x843/0x1330
 xfs_iomap_write_direct+0x3ba/0x6b0
 xfs_direct_write_iomap_begin+0xfbf/0x1410
 iomap_iter+0x600/0xf90
 __iomap_dio_rw+0xcd7/0x1e40
 iomap_dio_rw+0x45/0xb0
 xfs_file_dio_write_aligned+0x3b8/0x490
 xfs_file_write_iter+0x7dd/0x920
 iter_file_splice_write+0x9a1/0x10f0
 direct_splice_actor+0x101/0x160
 splice_direct_to_actor+0x53a/0xc70
 do_splice_direct+0x195/0x290
 do_sendfile+0x535/0x7d0
 __se_sys_sendfile64+0x144/0x1a0
 do_syscall_64+0x15f/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 8539:
 kasan_save_track+0x3e/0x80
 kasan_save_free_info+0x46/0x50
 __kasan_slab_free+0x5c/0x80
 kmem_cache_free+0x180/0x630
 __xfs_buf_ioend+0x28c/0x6f0
 xfs_buf_iowait+0x156/0x480
 xfs_buf_read_map+0x324/0xa10
 xfs_trans_read_buf_map+0x1db/0x8f0
 xfs_btree_read_buf_block+0x2b0/0x490
 xfs_btree_lookup_get_block+0x297/0x510
 xfs_btree_lookup+0x45a/0x1350
 xfs_alloc_fixup_trees+0x219/0xd30
 xfs_alloc_cur_finish+0xd5/0x4a0
 xfs_alloc_ag_vextent_near+0xd70/0x1280
 xfs_alloc_vextent_iterate_ags+0x640/0x950
 xfs_alloc_vextent_start_ag+0x378/0x850
 xfs_bmapi_allocate+0x17c1/0x2da0
 xfs_bmapi_write+0x843/0x1330
 xfs_iomap_write_direct+0x3ba/0x6b0
 xfs_direct_write_iomap_begin+0xfbf/0x1410
 iomap_iter+0x600/0xf90
 __iomap_dio_rw+0xcd7/0x1e40
 iomap_dio_rw+0x45/0xb0
 xfs_file_dio_write_aligned+0x3b8/0x490
 xfs_file_write_iter+0x7dd/0x920
 iter_file_splice_write+0x9a1/0x10f0
 direct_splice_actor+0x101/0x160
 splice_direct_to_actor+0x53a/0xc70
 do_splice_direct+0x195/0x290
 do_sendfile+0x535/0x7d0
 __se_sys_sendfile64+0x144/0x1a0
 do_syscall_64+0x15f/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff8881aa68e690
 which belongs to the cache xfs_buf_item of size 272
The buggy address is located 104 bytes inside of
 freed 272-byte region [ffff8881aa68e690, ffff8881aa68e7a0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1aa68e
flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 057ff00000000000 ffff8881046c6280 dead000000000122 0000000000000000
raw: 0000000000000000 00000008000c000c 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 8539, tgid 8538 (syz.6.331), ts 181335704885, free_ts 180469457144
 post_alloc_hook+0x231/0x280
 get_page_from_freelist+0x24dc/0x2580
 __alloc_frozen_pages_noprof+0x18d/0x380
 allocate_slab+0x77/0x660
 refill_objects+0x331/0x3c0
 __pcs_replace_empty_main+0x2e6/0x730
 kmem_cache_alloc_noprof+0x37d/0x650
 xfs_buf_item_init+0x6a/0x6d0
 xlog_recover_validate_buf_type+0xa2e/0xdb0
 xlog_recover_buf_commit_pass2+0xe26/0x1a40
 xlog_recover_items_pass2+0xe9/0x130
 xlog_recover_commit_trans+0x67a/0x8c0
 xlog_recovery_process_trans+0xab/0x1c0
 xlog_recover_process_ophdr+0x2f5/0x380
 xlog_recover_process_data+0x195/0x430
 xlog_do_recovery_pass+0x8d5/0xcd0
page last free pid 6931 tgid 6931 stack trace:
 free_unref_folios+0xecc/0x16e0
 folios_put_refs+0x789/0x8d0
 mapping_try_invalidate+0x3c2/0x4c0
 generic_shutdown_super+0x13d/0x2d0
 kill_block_super+0x44/0x90
 xfs_kill_sb+0x15/0x50
 deactivate_locked_super+0xbc/0x130
 cleanup_mnt+0x437/0x4d0
 task_work_run+0x1d9/0x270
 exit_to_user_mode_loop+0xed/0x480
 do_syscall_64+0x33e/0xf80
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Memory state around the buggy address:
 ffff8881aa68e580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881aa68e600: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc
>ffff8881aa68e680: fc fc fa fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                                ^
 ffff8881aa68e700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8881aa68e780: fb fb fb fb fc fc fc fc fc fc fc fc 00 00 00 00
==================================================================
