From: Linus Torvalds Date: Mon, 30 Jul 2018 21:27:15 +0000 (-0700) Subject: squashfs: more metadata hardening X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d512584780d3e6a7cacb2f482834849453d444a1;p=linux.git 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 Acked-by: Phillip Lougher Cc: stable@kernel.org Signed-off-by: Linus Torvalds --- diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c index 2751476e6b6e8..f098b9f1c3963 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)