linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't leak in arch/x86/boot/compressed/misc.c::parse_elf()
@ 2012-01-23 22:34 Jesper Juhl
  2012-01-26 13:39 ` [tip:x86/urgent] x86/boot-image: Don't leak phdrs in arch/x86/boot /compressed/misc.c::Parse_elf() tip-bot for Jesper Juhl
  0 siblings, 1 reply; 2+ messages in thread
From: Jesper Juhl @ 2012-01-23 22:34 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar

We allocate memory with malloc(), but neglect to free it before the
variable 'phdrs' goes out of scope --> leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 arch/x86/boot/compressed/misc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

 Note: Only compile tested.

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 3a19d04..7116dcb 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -321,6 +321,8 @@ static void parse_elf(void *output)
 		default: /* Ignore other PT_* */ break;
 		}
 	}
+
+	free(phdrs);
 }
 
 asmlinkage void decompress_kernel(void *rmode, memptr heap,
-- 
1.7.8.4


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* [tip:x86/urgent] x86/boot-image: Don't leak phdrs in arch/x86/boot /compressed/misc.c::Parse_elf()
  2012-01-23 22:34 [PATCH] Don't leak in arch/x86/boot/compressed/misc.c::parse_elf() Jesper Juhl
@ 2012-01-26 13:39 ` tip-bot for Jesper Juhl
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Jesper Juhl @ 2012-01-26 13:39 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, jj, tglx, mingo

Commit-ID:  5067cf53cac9b36d42ebb3a45bb12259d0bc1e68
Gitweb:     http://git.kernel.org/tip/5067cf53cac9b36d42ebb3a45bb12259d0bc1e68
Author:     Jesper Juhl <jj@chaosbits.net>
AuthorDate: Mon, 23 Jan 2012 23:34:59 +0100
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 26 Jan 2012 11:30:29 +0100

x86/boot-image: Don't leak phdrs in arch/x86/boot/compressed/misc.c::Parse_elf()

We allocate memory with malloc(), but neglect to free it before
the variable 'phdrs' goes out of scope --> leak.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Link: http://lkml.kernel.org/r/alpine.LNX.2.00.1201232332590.8772@swampdragon.chaosbits.net
[ Mostly harmless. ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/boot/compressed/misc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 3a19d04..7116dcb 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -321,6 +321,8 @@ static void parse_elf(void *output)
 		default: /* Ignore other PT_* */ break;
 		}
 	}
+
+	free(phdrs);
 }
 
 asmlinkage void decompress_kernel(void *rmode, memptr heap,

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

end of thread, other threads:[~2012-01-26 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-23 22:34 [PATCH] Don't leak in arch/x86/boot/compressed/misc.c::parse_elf() Jesper Juhl
2012-01-26 13:39 ` [tip:x86/urgent] x86/boot-image: Don't leak phdrs in arch/x86/boot /compressed/misc.c::Parse_elf() tip-bot for Jesper Juhl

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).