syz.0.1: attempt to access beyond end of device loop0: rw=2049, sector=10488, nr_sectors = 8 limit=0 syz.0.1: attempt to access beyond end of device loop0: rw=2049, sector=10496, nr_sectors = 96 limit=0 assertion failed: folio->mapping, in fs/btrfs/ordered-data.c:344 ------------[ cut here ]------------ kernel BUG at fs/btrfs/ordered-data.c:344! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 1 UID: 0 PID: 5313 Comm: syz.0.1 Not tainted 6.11.0-rc4-next-20240821-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:can_finish_ordered_extent+0x754/0x9e0 fs/btrfs/ordered-data.c:344 Code: e9 67 fe ff ff e8 1c 28 db fd 48 c7 c7 00 cf 4c 8c 48 c7 c6 60 d5 4c 8c 48 c7 c2 c0 ce 4c 8c b9 58 01 00 00 e8 4d e4 01 08 90 <0f> 0b e8 f5 27 db fd 48 c7 c7 00 cf 4c 8c 48 c7 c6 80 d5 4c 8c 48 RSP: 0018:ffffc90004046910 EFLAGS: 00010046 RAX: 0000000000000040 RBX: dffffc0000000000 RCX: ad5ab6c822489600 RDX: ffffc900093a9000 RSI: 000000000000cef3 RDI: 000000000000cef4 RBP: ffffea00017d9298 R08: ffffffff81744b8c R09: 1ffff1101722519a R10: dffffc0000000000 R11: ffffed101722519b R12: ffff888061f48000 R13: 0000000000000000 R14: ffff888061f48000 R15: ffffea00017d9280 FS: 00007fa0ac1876c0(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b326fbff8 CR3: 000000002ee76000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: btrfs_finish_ordered_extent+0x140/0x480 fs/btrfs/ordered-data.c:410 end_bbio_data_write+0x4bd/0x750 fs/btrfs/extent_io.c:476 __btrfs_bio_end_io fs/btrfs/bio.c:116 [inline] btrfs_orig_bbio_end_io+0x3ba/0x470 fs/btrfs/bio.c:162 btrfs_submit_chunk fs/btrfs/bio.c:756 [inline] btrfs_submit_bio+0x11fc/0x1940 fs/btrfs/bio.c:775 submit_one_bio+0x115/0x1c0 fs/btrfs/extent_io.c:120 submit_extent_folio+0xad3/0xe90 submit_one_sector fs/btrfs/extent_io.c:1315 [inline] __extent_writepage_io+0x84e/0xc90 fs/btrfs/extent_io.c:1391 __extent_writepage fs/btrfs/extent_io.c:1457 [inline] extent_write_cache_pages fs/btrfs/extent_io.c:2125 [inline] btrfs_writepages+0x1132/0x22a0 fs/btrfs/extent_io.c:2251 do_writepages+0x35d/0x870 mm/page-writeback.c:2683 filemap_fdatawrite_wbc+0x125/0x180 mm/filemap.c:397 __filemap_fdatawrite_range mm/filemap.c:430 [inline] filemap_fdatawrite_range+0x11a/0x180 mm/filemap.c:448 btrfs_fdatawrite_range fs/btrfs/file.c:3778 [inline] start_ordered_ops fs/btrfs/file.c:1546 [inline] btrfs_sync_file+0x31d/0x10f0 fs/btrfs/file.c:1623 generic_write_sync include/linux/fs.h:2853 [inline] btrfs_do_write_iter+0x5e2/0x760 fs/btrfs/file.c:1498 do_iter_readv_writev+0x60a/0x890 vfs_writev+0x37c/0xbb0 fs/read_write.c:971 do_pwritev fs/read_write.c:1072 [inline] __do_sys_pwritev2 fs/read_write.c:1131 [inline] __se_sys_pwritev2+0x1ca/0x2d0 fs/read_write.c:1122 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fa0ab379e79 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fa0ac187038 EFLAGS: 00000246 ORIG_RAX: 0000000000000148 RAX: ffffffffffffffda RBX: 00007fa0ab515f80 RCX: 00007fa0ab379e79 RDX: 0000000000000001 RSI: 0000000020000100 RDI: 0000000000000006 RBP: 00007fa0ab3e7916 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000005412 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fa0ab515f80 R15: 00007ffed1585fa8 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:can_finish_ordered_extent+0x754/0x9e0 fs/btrfs/ordered-data.c:344 Code: e9 67 fe ff ff e8 1c 28 db fd 48 c7 c7 00 cf 4c 8c 48 c7 c6 60 d5 4c 8c 48 c7 c2 c0 ce 4c 8c b9 58 01 00 00 e8 4d e4 01 08 90 <0f> 0b e8 f5 27 db fd 48 c7 c7 00 cf 4c 8c 48 c7 c6 80 d5 4c 8c 48 RSP: 0018:ffffc90004046910 EFLAGS: 00010046 RAX: 0000000000000040 RBX: dffffc0000000000 RCX: ad5ab6c822489600 RDX: ffffc900093a9000 RSI: 000000000000cef3 RDI: 000000000000cef4 RBP: ffffea00017d9298 R08: ffffffff81744b8c R09: 1ffff1101722519a R10: dffffc0000000000 R11: ffffed101722519b R12: ffff888061f48000 R13: 0000000000000000 R14: ffff888061f48000 R15: ffffea00017d9280 FS: 00007fa0ac1876c0(0000) GS:ffff8880b9100000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b326fbff8 CR3: 000000002ee76000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400