]> git.baikalelectronics.ru Git - kernel.git/commit
Squashfs: Compute expected length from inode size rather than block length
authorPhillip Lougher <phillip@squashfs.org.uk>
Thu, 2 Aug 2018 15:45:15 +0000 (16:45 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Aug 2018 16:34:02 +0000 (09:34 -0700)
commit91fac2d411151dbaaa53c3bc1dd03e94659173e6
tree9de67b4b1fa9b93ded20dc65bd4b7fd059ef6813
parent95fffaa386c787a3132abde085ce66c434b6fa01
Squashfs: Compute expected length from inode size rather than block length

Previously in squashfs_readpage() when copying data into the page
cache, it used the length of the datablock read from the filesystem
(after decompression).  However, if the filesystem has been corrupted
this data block may be short, which will leave pages unfilled.

The fix for this is to compute the expected number of bytes to copy
from the inode size, and use this to detect if the block is short.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Tested-by: Willy Tarreau <w@1wt.eu>
Cc: Анатолий Тросиненко <anatoly.trosinenko@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/squashfs/file.c
fs/squashfs/file_cache.c
fs/squashfs/file_direct.c
fs/squashfs/squashfs.h