summaryrefslogtreecommitdiffstats
path: root/fs/squashfs/block.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-30 14:27:15 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-30 17:29:17 -0700
commitd512584780d3e6a7cacb2f482834849453d444a1 (patch)
treee69a975786d0bff7cd3e117f88dc9b97380806e1 /fs/squashfs/block.c
parent527838d470e3a6e79e8ee9d5ddf28920df2a196e (diff)
downloadlinux-d512584780d3e6a7cacb2f482834849453d444a1.tar.bz2
squashfs: more metadata hardening
Anatoly reports another squashfs fuzzing issue, where the decompression parameters themselves are in a compressed block. This causes squashfs_read_data() to be called in order to read the decompression options before the decompression stream having been set up, making squashfs go sideways. Reported-by: Anatoly Trosinenko <anatoly.trosinenko@gmail.com> Acked-by: Phillip Lougher <phillip.lougher@gmail.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/squashfs/block.c')
-rw-r--r--fs/squashfs/block.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 2751476e6b6e..f098b9f1c396 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -167,6 +167,8 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
}
if (compressed) {
+ if (!msblk->stream)
+ goto read_failure;
length = squashfs_decompress(msblk, bh, b, offset, length,
output);
if (length < 0)