From: Sasha Levin Date: Thu, 28 Feb 2013 01:03:28 +0000 (-0800) Subject: kexec: prevent double free on image allocation failure X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fe88f2ee33731f0934e8fb26f762b6715e43ff6f;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Cc: "Eric W. Biederman" Cc: Zhang Yanfei Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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, 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