]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iomap: fix iomap_dio_zero() for fs bs > system page size
authorPankaj Raghav <p.raghav@samsung.com>
Thu, 22 Aug 2024 13:50:14 +0000 (15:50 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 2 Sep 2024 14:19:43 +0000 (16:19 +0200)
commit10553a91652d995274da63fc317470f703765081
treede537e1c09236a5292bdf54798de02c3e7a12fd3
parent743a2753a02e805347969f6f89f38b736850d808
iomap: fix iomap_dio_zero() for fs bs > system page size

iomap_dio_zero() will pad a fs block with zeroes if the direct IO size
< fs block size. iomap_dio_zero() has an implicit assumption that fs block
size < page_size. This is true for most filesystems at the moment.

If the block size > page size, this will send the contents of the page
next to zero page(as len > PAGE_SIZE) to the underlying block device,
causing FS corruption.

iomap is a generic infrastructure and it should not make any assumptions
about the fs block size and the page size of the system.

Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
Link: https://lore.kernel.org/r/20240822135018.1931258-7-kernel@pankajraghav.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Daniel Gomez <da.gomez@samsung.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/iomap/buffered-io.c
fs/iomap/direct-io.c