From: Phillip Lougher on

The unpack routine fails to handle the decompress_method() returning
unrecognised decompressor (compress_name == NULL). This results in
the routine looping eventually oopsing on an out of bounds memory

Note this bug is usually hidden, only triggering on trailing
junk after one or more correct compressed blocks. The
case of the compressed archive being complete junk
is (by accident?) caught by the if (state != Reset) check
because state is initialised to Start, but not updated due to
the decompressor not having been called. Obviously if the junk
is trailing a correctly decompressed buffer, state == Reset from the
previous call to the decompressor.

Reported-by: Aaro Koskinen <aaro.koskinen(a)>
Signed-off-by: Phillip Lougher <phillip(a)>
init/initramfs.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/init/initramfs.c b/init/initramfs.c
index 37d3859..4b9c202 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -457,7 +457,8 @@ static char * __init unpack_to_rootfs(char *buf, unsigned len)
message = msg_buf;
- }
+ } else
+ error("junk in compressed archive");
if (state != Reset)
error("junk in compressed archive");
this_header = saved_offset + my_inptr;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at