linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] unlzo: Fix input buffer free
@ 2011-11-17 21:29 Sascha Hauer
  2011-11-18 17:10 ` Lasse Collin
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2011-11-17 21:29 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Lasse Collin, Sascha Hauer

unlzo modifies the pointer to in_buf, so we have to free the
original buffer, not the modified pointer. This only happens
when a fill function is passed, a case which is currently unused
in the kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 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 5a7a2ad..4531294 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.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] unlzo: Fix input buffer free
  2011-11-17 21:29 [PATCH] unlzo: Fix input buffer free Sascha Hauer
@ 2011-11-18 17:10 ` Lasse Collin
  0 siblings, 0 replies; 2+ messages in thread
From: Lasse Collin @ 2011-11-18 17:10 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: linux-kernel, Andrew Morton

On 2011-11-17 Sascha Hauer wrote:
> unlzo modifies the pointer to in_buf, so we have to free the
> original buffer, not the modified pointer.

The fix looks good.

> This only happens when a fill function is passed, a case which is
> currently unused in the kernel.

It is used for initrd decompression (not initramfs) in
init/do_mounts_rd.c in crd_load(). The problematic code can only get
run when the initrd is corrupt and thus the system will panic anyway.

-- 
Lasse Collin  |  IRC: Larhzu @ IRCnet & Freenode

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-18 17:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-17 21:29 [PATCH] unlzo: Fix input buffer free Sascha Hauer
2011-11-18 17:10 ` Lasse Collin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).