diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2018-08-02 18:45:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-05 10:26:32 +0300 |
commit | 28013eecf6a0f04c121912f57aed03db55493dfe (patch) | |
tree | 9033d47e32ae037bb539fc33acbcda7a7aa489b0 /fs/squashfs/squashfs.h | |
parent | 249778d9459a4ed9f8dada4ca8ccc2ff09407482 (diff) | |
download | linux-28013eecf6a0f04c121912f57aed03db55493dfe.tar.xz |
Squashfs: Compute expected length from inode size rather than block length
[ Upstream commit a3f94cb99a854fa381fe7fadd97c4f61633717a5 ]
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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/squashfs/squashfs.h')
-rw-r--r-- | fs/squashfs/squashfs.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/squashfs/squashfs.h b/fs/squashfs/squashfs.h index d8d43724cf2a..f89f8a74c6ce 100644 --- a/fs/squashfs/squashfs.h +++ b/fs/squashfs/squashfs.h @@ -72,7 +72,7 @@ void squashfs_copy_cache(struct page *, struct squashfs_cache_entry *, int, int); /* file_xxx.c */ -extern int squashfs_readpage_block(struct page *, u64, int); +extern int squashfs_readpage_block(struct page *, u64, int, int); /* id.c */ extern int squashfs_get_id(struct super_block *, unsigned int, unsigned int *); |