aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-02-27 20:03:28 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 22:10:12 -0500
commitfe88f2ee33731f0934e8fb26f762b6715e43ff6f (patch)
treeb6e8af3812192ca5d8a60c51faaa9a025dbe7a5e /kernel
parent0d0bf6674136eb861b37213160b16388cfc1926d (diff)
kexec: prevent double free on image allocation failure
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> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/kexec.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/kernel/kexec.c b/kernel/kexec.c
index 2348bd6ef2af..855bfbbf4048 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -242,8 +242,6 @@ static int kimage_normal_alloc(struct kimage **rimage, unsigned long entry,
242 if (result) 242 if (result)
243 goto out; 243 goto out;
244 244
245 *rimage = image;
246
247 /* 245 /*
248 * Find a location for the control code buffer, and add it 246 * Find a location for the control code buffer, and add it
249 * the vector of segments so that it's pages will also be 247 * the vector of segments so that it's pages will also be