[PATCH U-BOOT v2] btrfs: fix offset when reading compressed extents

Tom Rini trini at konsulko.com
Mon May 8 19:38:50 CEST 2023


On Tue, 18 Apr 2023 15:41:55 +0900, Dominique Martinet wrote:

> btrfs_read_extent_reg correctly computed the extent offset in the
> BTRFS_COMPRESS_NONE case, but did not account for the 'offset - key.offset'
> part correctly in the compressed case, making the function read
> incorrect data.
> 
> In the case I examined, the last 4k of a file was corrupted and
> contained data from a few blocks prior, e.g. reading a 10k file with a
> single extent:
> btrfs_file_read()
>  -> btrfs_read_extent_reg
>     (aligned part loop, until 8k)
>  -> read_and_truncate_page
>    -> btrfs_read_extent_reg
>       (re-reads the last extent from 8k to the end,
>       incorrectly reading the first 2k of data)
> 
> [...]

Applied to u-boot/master, thanks!

-- 
Tom



More information about the U-Boot mailing list