mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib: fix potential memory free failure on unlzo()
@ 2011-11-20  7:47 Namhyung Kim
  0 siblings, 0 replies; only message in thread
From: Namhyung Kim @ 2011-11-20  7:47 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Albin Tonnerre, Lasse Collin

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-20  7:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-20  7:47 [PATCH] lib: fix potential memory free failure on unlzo() Namhyung Kim

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®