From: Darrick J. Wong Filesystems should never provide a delayed allocation mapping to writeback; they're supposed to allocate the space before replying. This can lead to weird IO errors and crashes in the block layer if the filesystem is being malicious, or if it hadn't set iomap->dev because it's a delalloc mapping. Fix this by failing writeback on delalloc mappings. Currently no filesystems actually misbehave in this manner, but we ought to be stricter about things like that. Cc: # v5.5 Fixes: 598ecfbaa742ac ("iomap: lift the xfs writeback code to iomap") Signed-off-by: "Darrick J. Wong" --- fs/iomap/ioend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/iomap/ioend.c b/fs/iomap/ioend.c index 4d1ef8a2cee90b..62dd539e087c7d 100644 --- a/fs/iomap/ioend.c +++ b/fs/iomap/ioend.c @@ -216,6 +216,7 @@ ssize_t iomap_add_to_ioend(struct iomap_writepage_ctx *wpc, struct folio *folio, switch (wpc->iomap.type) { case IOMAP_INLINE: + case IOMAP_DELALLOC: WARN_ON_ONCE(1); return -EIO; case IOMAP_HOLE: