[PATCH 2/5] squashfs: more metadata hardening

Paolo Pisati paolo.pisati at canonical.com
Tue Feb 19 14:23:26 UTC 2019


From: Linus Torvalds <torvalds at linux-foundation.org>

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 at gmail.com>
Acked-by: Phillip Lougher <phillip.lougher at gmail.com>
Cc: stable at kernel.org
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
(cherry picked from commit d512584780d3e6a7cacb2f482834849453d444a1)
Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
 fs/squashfs/block.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 2751476..f098b9f 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)
-- 
2.7.4




More information about the kernel-team mailing list