Re: [PATCH 5.10.y] iomap: adjust read range correctly for non-block-aligned positions

Greg KH <[email protected]>
Newsgroups org.kernel.vger.stable,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-xfs
Message-ID <2026082434-freeway-legwarmer-84e6@gregkh>
On Thu, Aug 20, 2026 at 07:03:07PM +0200, Miguel Gazquez (Schneider Electric) wrote:
> From: Joanne Koong <[email protected]>
> 
> [ Upstream commit 7aa6bc3e8766990824f66ca76c19596ce10daf3e ]
> 
> iomap_adjust_read_range() assumes that the position and length passed in
> are block-aligned. This is not always the case however, as shown in the
> syzbot generated case for erofs. This causes too many bytes to be
> skipped for uptodate blocks, which results in returning the incorrect
> position and length to read in. If all the blocks are uptodate, this
> underflows length and returns a position beyond the folio.
> 
> Fix the calculation to also take into account the block offset when
> calculating how many bytes can be skipped for uptodate blocks.
> 
> Signed-off-by: Joanne Koong <[email protected]>
> Tested-by: [email protected]
> Reviewed-by: Brian Foster <[email protected]>
> Reviewed-by: Christoph Hellwig <[email protected]>
> Signed-off-by: Christian Brauner <[email protected]>
> Signed-off-by: Sasha Levin <[email protected]>
> Signed-off-by: Miguel Gazquez (Schneider Electric) <[email protected]>
> ---
>  fs/iomap/buffered-io.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)

Don't we also need this for 5.15.y first?

thanks,

greg k-h
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.