FAILED: patch "[PATCH] arm64: kexec_file: Fix elf_headers memory leak in retry loop" failed to apply to 5.10-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x ac302aea3d824ccc99f29b8e499c365cb9a684a9
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From ac302aea3d824ccc99f29b8e499c365cb9a684a9 Mon Sep 17 00:00:00 2001
From: Jinjie Ruan <[email protected]>
Date: Thu, 5 Nov 2026 20:57:24 +0800
Subject: [PATCH] arm64: kexec_file: Fix elf_headers memory leak in retry loop
A retry allocates new elf headers and overwrites image->elf_headers, leaking the previous buffer.
Free it before assigning.
--- arch/arm64/kernel/machine_kexec_file.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/machine_kexec_file.c +2 -0
@@ -112,6 +112,8 @@ int load_other_segments(struct kimage *image,vfree (headers); goto out_err; } + +vfree (image->elf_headers); image->elf_headers = headers; image->elf_load_addr = kbuf.mem; image->elf_headers_sz = headers_sz;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 arm64: kexec_file: Fix elf_headers memory leak in retry loop
From: Jinjie Ruan <[email protected]>
[ Upstream commit ac302aea3d824ccc99f29b8e499c365cb9a684a9 ]
A retry allocates new elf headers and overwrites image->elf_headers, leaking the previous buffer.
Free it before assigning.
--- arch/arm64/kernel/machine_kexec_file.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/kernel/machine_kexec_file.c +2 -0
@@ -284,6 +284,8 @@ int load_other_segments(struct kimage *image,vfree (headers); goto out_err; } + +vfree (image->arch.elf_headers); image->arch.elf_headers = headers; image->arch.elf_headers_mem = kbuf.mem; image->arch.elf_headers_sz = headers_sz;
Signature · 1 line
2.53.0