public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] kexec: prevent double free on image allocation failure
@ 2013-02-22  1:26 Sasha Levin
  2013-02-22  1:55 ` Eric W. Biederman
  0 siblings, 1 reply; 6+ messages in thread
From: Sasha Levin @ 2013-02-22  1:26 UTC (permalink / raw)
  To: ebiederm; +Cc: Sasha Levin, kexec, linux-kernel

If kimage_normal_alloc() fails to initialize an allocated kimage, it will free
the image but would still set 'rimage', as a result kexec_load will try
to free it again.

This would explode as part of the freeing process is accessing internal
members which point to uninitialized memory.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
 kernel/kexec.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/kernel/kexec.c b/kernel/kexec.c
index 2348bd6..855bfbb 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -242,8 +242,6 @@ static int kimage_normal_alloc(struct kimage **rimage, unsigned long entry,
 	if (result)
 		goto out;
 
-	*rimage = image;
-
 	/*
 	 * Find a location for the control code buffer, and add it
 	 * the vector of segments so that it's pages will also be
-- 
1.8.1.2


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2013-02-22  4:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-22  1:26 [PATCH] kexec: prevent double free on image allocation failure Sasha Levin
2013-02-22  1:55 ` Eric W. Biederman
2013-02-22  2:33   ` Sasha Levin
2013-02-22  2:46   ` Zhang Yanfei
2013-02-22  3:41     ` Sasha Levin
2013-02-22  3:58       ` Zhang Yanfei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox