Commit 35302aef authored by Linus Torvalds's avatar Linus Torvalds Committed by Kleber Sacilotto de Souza

squashfs: more metadata hardening

BugLink: https://bugs.launchpad.net/bugs/1791953

commit d5125847 upstream.

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: default avatarAnatoly Trosinenko <anatoly.trosinenko@gmail.com>
Acked-by: default avatarPhillip Lougher <phillip.lougher@gmail.com>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent aac0d64d
...@@ -166,6 +166,8 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length, ...@@ -166,6 +166,8 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
} }
if (compressed) { if (compressed) {
if (!msblk->stream)
goto read_failure;
length = squashfs_decompress(msblk, bh, b, offset, length, length = squashfs_decompress(msblk, bh, b, offset, length,
output); output);
if (length < 0) if (length < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment