From: Namhyung Kim <namhyung@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org,
Albin Tonnerre <albin.tonnerre@free-electrons.com>,
Lasse Collin <lasse.collin@tukaani.org>
Subject: [PATCH] lib: fix potential memory free failure on unlzo()
Date: Sun, 20 Nov 2011 16:47:31 +0900 [thread overview]
Message-ID: <1321775251-3274-1-git-send-email-namhyung@gmail.com> (raw)
in_buf is dynamically allocated if @input is not given,
and adjusted as processing data on every loop. However
if block metadata is corrupted it will bail out the loop
in the middle, thus in_buf will point out wrong memory.
Fix it by freeing in_buf_save instead.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
Cc: Lasse Collin <lasse.collin@tukaani.org>
---
lib/decompress_unlzo.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/decompress_unlzo.c b/lib/decompress_unlzo.c
index 5a7a2adf4c4c..4531294fa62f 100644
--- a/lib/decompress_unlzo.c
+++ b/lib/decompress_unlzo.c
@@ -279,7 +279,7 @@ STATIC inline int INIT unlzo(u8 *input, int in_len,
ret = 0;
exit_2:
if (!input)
- free(in_buf);
+ free(in_buf_save);
exit_1:
if (!output)
free(out_buf);
--
1.7.6
reply other threads:[~2011-11-20 7:47 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=1321775251-3274-1-git-send-email-namhyung@gmail.com \
--to=namhyung@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=albin.tonnerre@free-electrons.com \
--cc=lasse.collin@tukaani.org \
--cc=linux-kernel@vger.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®