From: ebiederm@xmission.com (Eric W. Biederman)
To: Sasha Levin <sasha.levin@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kexec: prevent double free on image allocation failure
Date: Thu, 21 Feb 2013 17:55:27 -0800 [thread overview]
Message-ID: <87vc9l5cz4.fsf@xmission.com> (raw)
In-Reply-To: <1361496375-30994-1-git-send-email-sasha.levin@oracle.com> (Sasha Levin's message of "Thu, 21 Feb 2013 20:26:15 -0500")
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
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2013-02-22 1:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-22 1:26 [PATCH] kexec: prevent double free on image allocation failure Sasha Levin
2013-02-22 1:55 ` Eric W. Biederman [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vc9l5cz4.fsf@xmission.com \
--to=ebiederm@xmission.com \
--cc=akpm@linux-foundation.org \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox