* [PATCH] initramfs: handle unrecognised decompressor when unpacking
@ 2010-04-23 3:02 Phillip Lougher
0 siblings, 0 replies; only message in thread
From: Phillip Lougher @ 2010-04-23 3:02 UTC (permalink / raw)
To: Linux Kernel Development
Cc: Andrew Morton, Aaro Koskinen, hsweeten, H. Peter Anvin,
eric.piel, stable
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
access.
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@iki.fi>
Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
---
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)
compress_name);
message = msg_buf;
}
- }
+ } else
+ error("junk in compressed archive");
if (state != Reset)
error("junk in compressed archive");
this_header = saved_offset + my_inptr;
--
1.6.3.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-23 3:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-23 3:02 [PATCH] initramfs: handle unrecognised decompressor when unpacking Phillip Lougher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®