lkml.org 
[lkml]   [2013]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] kexec: prevent double free on image allocation failure
Sasha Levin <sasha.levin@oracle.com> writes:

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

Agreed.

I don't think that failure path has ever actually been exercised.

The code is wrong, and it is worth fixing.

Andrew I do you think you could queue this up? I don't have a handy tree.

Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com>
> 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


\
 
 \ /
  Last update: 2013-02-22 03:41    [W:0.038 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site