From: "tip-bot2 for Takashi Iwai" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>,
"Borislav Petkov (AMD)" <bp@alien8.de>,
Baoquan He <bhe@redhat.com>, Vlastimil Babka <vbabka@suse.cz>,
<stable@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/urgent] x86/kexec: Fix double-free of elf header buffer
Date: Mon, 02 Jan 2023 18:04:15 -0000 [thread overview]
Message-ID: <167268265568.4906.5498168349735742588.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20221122115122.13937-1-tiwai@suse.de>
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: d00dd2f2645dca04cf399d8fc692f3f69b6dd996
Gitweb: https://git.kernel.org/tip/d00dd2f2645dca04cf399d8fc692f3f69b6dd996
Author: Takashi Iwai <tiwai@suse.de>
AuthorDate: Tue, 22 Nov 2022 12:51:22 +01:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Mon, 02 Jan 2023 18:56:21 +01:00
x86/kexec: Fix double-free of elf header buffer
After
b3e34a47f989 ("x86/kexec: fix memory leak of elf header buffer"),
freeing image->elf_headers in the error path of crash_load_segments()
is not needed because kimage_file_post_load_cleanup() will take
care of that later. And not clearing it could result in a double-free.
Drop the superfluous vfree() call at the error path of
crash_load_segments().
Fixes: b3e34a47f989 ("x86/kexec: fix memory leak of elf header buffer")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/20221122115122.13937-1-tiwai@suse.de
---
arch/x86/kernel/crash.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 9730c88..3055144 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -401,10 +401,8 @@ int crash_load_segments(struct kimage *image)
kbuf.buf_align = ELF_CORE_HEADER_ALIGN;
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
ret = kexec_add_buffer(&kbuf);
- if (ret) {
- vfree((void *)image->elf_headers);
+ if (ret)
return ret;
- }
image->elf_load_addr = kbuf.mem;
pr_debug("Loaded ELF headers at 0x%lx bufsz=0x%lx memsz=0x%lx\n",
image->elf_load_addr, kbuf.bufsz, kbuf.memsz);
prev parent reply other threads:[~2023-01-02 18:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-22 11:51 [PATCH] " Takashi Iwai
2022-11-23 9:19 ` Baoquan He
2023-01-02 11:37 ` Vlastimil Babka
2023-01-02 18:04 ` tip-bot2 for Takashi Iwai [this message]
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=167268265568.4906.5498168349735742588.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bhe@redhat.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=stable@kernel.org \
--cc=tiwai@suse.de \
--cc=vbabka@suse.cz \
--cc=x86@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
all inboxes | Powered by JetHome®