mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Phillip Lougher <phillip@lougher.demon.co.uk>
To: Linux Kernel Development <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Aaro Koskinen <aaro.koskinen@iki.fi>,
	hsweeten@visionengravers.com, "H. Peter Anvin" <hpa@zytor.com>,
	eric.piel@tremplin-utc.net, stable <stable@kernel.org>
Subject: [PATCH] initramfs: handle unrecognised decompressor when unpacking
Date: Fri, 23 Apr 2010 04:02:29 +0100	[thread overview]
Message-ID: <4BD10DC5.4030407@lougher.demon.co.uk> (raw)


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


                 reply	other threads:[~2010-04-23  3:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4BD10DC5.4030407@lougher.demon.co.uk \
    --to=phillip@lougher.demon.co.uk \
    --cc=aaro.koskinen@iki.fi \
    --cc=akpm@linux-foundation.org \
    --cc=eric.piel@tremplin-utc.net \
    --cc=hpa@zytor.com \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®