public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Baoquan He <bhe@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: kexec@lists.infradead.org, dyoung@redhat.com,
	akpm@linux-foundation.org, Baoquan He <bhe@redhat.com>
Subject: [PATCH 2/3] x86/kexec: remove incorrect elf header buffer freeing
Date: Fri, 29 Oct 2021 15:24:23 +0800	[thread overview]
Message-ID: <20211029072424.9109-3-bhe@redhat.com> (raw)
In-Reply-To: <20211029072424.9109-1-bhe@redhat.com>

Before calling arch specific kexec_file loading function, the image
instance has been initialized. So 'image->elf_headers' must be NULL.
It doesn't make sense to free the elf header buffer in the place.

So remove it.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 arch/x86/kernel/machine_kexec_64.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index fd8223fa2de5..dc8b17568784 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -373,9 +373,6 @@ void machine_kexec(struct kimage *image)
 #ifdef CONFIG_KEXEC_FILE
 void *arch_kexec_kernel_image_load(struct kimage *image)
 {
-	vfree(image->elf_headers);
-	image->elf_headers = NULL;
-
 	if (!image->fops || !image->fops->load)
 		return ERR_PTR(-ENOEXEC);
 
-- 
2.17.2


  parent reply	other threads:[~2021-10-29  7:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29  7:24 [PATCH 0/3] x86/kexec: fix memory leak of elf header buffer Baoquan He
2021-10-29  7:24 ` [PATCH 1/3] " Baoquan He
2021-11-22  1:55   ` Baoquan He
2021-10-29  7:24 ` Baoquan He [this message]
2021-10-29  7:24 ` [PATCH 3/3] kexec_file: clean up arch_kexec_kernel_image_load Baoquan He
2021-11-01  6:54 ` [PATCH 0/3] x86/kexec: fix memory leak of elf header buffer Dave Young

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=20211029072424.9109-3-bhe@redhat.com \
    --to=bhe@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dyoung@redhat.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /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