Re: [syzbot] [iomap?] [xfs?] WARNING in iomap_write_begin

Julian Sun
2024-09-02T05:04:59Z

Test the following patch.

#syz test: upstream ee9a43b7cfe2

diff --git a/fs/iomap/iter.c b/fs/iomap/iter.c
index 79a0614eaab7..6e3f6109cac5 100644
--- a/fs/iomap/iter.c
+++ b/fs/iomap/iter.c
@@ -76,7 +76,8 @@ int iomap_iter(struct iomap_iter *iter, const struct iomap_ops *ops)
int ret;

if (iter->iomap.length && ops->iomap_end) {
- ret = ops->iomap_end(iter->inode, iter->pos, iomap_length(iter),
+ ret = ops->iomap_end(iter->inode, iter->pos,
+ iter->processed > 0 ? iomap_length(iter) : iter->iomap.length,
iter->processed > 0 ? iter->processed : 0,
iter->flags, &iter->iomap);
if (ret < 0 && !iter->processed)