[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260206043121.197564-2-ranxiaokai627@163.com>
Date: Fri, 6 Feb 2026 04:31:20 +0000
From: ranxiaokai627@....com
To: graf@...zon.com,
rppt@...nel.org,
pasha.tatashin@...een.com,
pratyush@...nel.org,
akpm@...ux-foundation.org
Cc: kexec@...ts.infradead.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
ran.xiaokai@....com.cn,
ranxiaokai627@....com,
stable@...r.kernel.org
Subject: [PATCH -next 1/2] kho: fix missing early_memunmap() call in kho_populate()
From: Ran Xiaokai <ran.xiaokai@....com.cn>
kho_populate() returns without calling early_memunmap() on success
path, this will cause early ioremap virtual address space leak.
Fixes: b50634c5e84a ("kho: cleanup error handling in kho_populate()")
Signed-off-by: Ran Xiaokai <ran.xiaokai@....com.cn>
---
b50634c5e84a ("kho: cleanup error handling in kho_populate()")
has not landed in upstream, so
Cc: <stable@...r.kernel.org> is unnecessary?
kernel/liveupdate/kexec_handover.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index fb3a7b67676e..76b714db175d 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -1463,6 +1463,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
struct kho_scratch *scratch = NULL;
phys_addr_t mem_map_phys;
void *fdt = NULL;
+ int populated = 0;
int err;
/* Validate the input FDT */
@@ -1529,16 +1530,17 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
kho_in.scratch_phys = scratch_phys;
kho_in.mem_map_phys = mem_map_phys;
kho_scratch_cnt = scratch_cnt;
- pr_info("found kexec handover data.\n");
- return;
+ populated = 1;
+ pr_info("found kexec handover data.\n");
err_unmap_scratch:
early_memunmap(scratch, scratch_len);
err_unmap_fdt:
early_memunmap(fdt, fdt_len);
err_report:
- pr_warn("disabling KHO revival\n");
+ if (!populated)
+ pr_warn("disabling KHO revival\n");
}
/* Helper functions for kexec_file_load */
--
2.25.1
Powered by blists - more mailing lists