]> www.infradead.org Git - users/dwmw2/linux.git/commit
btrfs: compression: add an ASSERT() to ensure the read-in length is sane
authorQu Wenruo <wqu@suse.com>
Fri, 6 Sep 2024 04:57:56 +0000 (14:27 +0930)
committerDavid Sterba <dsterba@suse.com>
Mon, 11 Nov 2024 13:34:12 +0000 (14:34 +0100)
commitdd5e2762544d9bd59c101de0afaad1317c2876a0
tree30f68cc336d82d031f9596cdd5dbfcb0688ca891
parent90275a7762c85bde21c0884404993ed20e265d86
btrfs: compression: add an ASSERT() to ensure the read-in length is sane

There are already two bugs (one in zlib, one in zstd) that involved
compression path is not handling sector size < page size cases well.

So it makes more sense to make sure that btrfs_compress_folios() returns

Since we already have two bugs (one in zlib, one in zstd) in the
compression path resulting the @total_in be to larger than the
to-be-compressed range length, there is enough reason to add an ASSERT()
to make sure the total read-in length doesn't exceed the input length.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/compression.c