Fix squashfs failing to load sparse files
authorCampbell Suter <campbell@snapit.group>
Mon, 23 Nov 2020 02:40:03 +0000 (15:40 +1300)
committerTom Rini <trini@konsulko.com>
Wed, 20 Jan 2021 19:01:44 +0000 (14:01 -0500)
commit9dba07f14304612ed4ee6d827898aa0cb55d4e26
tree993e262d50a903b112a025f4e5d169407476fa81
parent3b72612ad191cad29aad3982221ff3355bec798d
Fix squashfs failing to load sparse files

SquashFS supports sprase blocks in files - that is, if a given block is
composed only of zeros, it's not written to the output file to save
space and it's on-disk length field is set to zero to indicate that.

Previously the squashfs driver did not recognise that, and would attempt
to read and decompress a zero-sized block, which obviously failed.

The following command may be used to create a file for testing:

cat <(dd if=/dev/urandom of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/zero of=/dev/stdout bs=1M count=1) \
<(dd if=/dev/urandom of=/dev/stdout bs=1k count=200) >test_file

Signed-off-by: Campbell Suter <campbell@snapit.group>
fs/squashfs/sqfs.c