* [PATCH -next 0/2] two fixes in kho_populate()
@ 2026-02-06 4:31 ranxiaokai627
2026-02-06 4:31 ` [PATCH -next 1/2] kho: fix missing early_memunmap() call " ranxiaokai627
2026-02-06 4:31 ` [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) " ranxiaokai627
0 siblings, 2 replies; 7+ messages in thread
From: ranxiaokai627 @ 2026-02-06 4:31 UTC (permalink / raw)
To: graf, rppt, pasha.tatashin, pratyush, akpm
Cc: kexec, linux-mm, linux-kernel, ran.xiaokai, ranxiaokai627
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Patch1 fixes unpaired call of early_memmap()/early_memunmap()
Patch2 cleans up unnecessary call of WARN_ON()
Ran Xiaokai (2):
kho: fix missing early_memunmap() call in kho_populate()
kho: remove unnecessary WARN_ON(err) in kho_populate()
kernel/liveupdate/kexec_handover.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next 1/2] kho: fix missing early_memunmap() call in kho_populate()
2026-02-06 4:31 [PATCH -next 0/2] two fixes in kho_populate() ranxiaokai627
@ 2026-02-06 4:31 ` ranxiaokai627
2026-02-10 13:45 ` Pratyush Yadav
2026-02-06 4:31 ` [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) " ranxiaokai627
1 sibling, 1 reply; 7+ messages in thread
From: ranxiaokai627 @ 2026-02-06 4:31 UTC (permalink / raw)
To: graf, rppt, pasha.tatashin, pratyush, akpm
Cc: kexec, linux-mm, linux-kernel, ran.xiaokai, ranxiaokai627, stable
From: Ran Xiaokai <ran.xiaokai@zte.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@zte.com.cn>
---
b50634c5e84a ("kho: cleanup error handling in kho_populate()")
has not landed in upstream, so
Cc: <stable@vger.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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) in kho_populate()
2026-02-06 4:31 [PATCH -next 0/2] two fixes in kho_populate() ranxiaokai627
2026-02-06 4:31 ` [PATCH -next 1/2] kho: fix missing early_memunmap() call " ranxiaokai627
@ 2026-02-06 4:31 ` ranxiaokai627
2026-02-07 17:34 ` Pasha Tatashin
2026-02-10 13:45 ` Pratyush Yadav
1 sibling, 2 replies; 7+ messages in thread
From: ranxiaokai627 @ 2026-02-06 4:31 UTC (permalink / raw)
To: graf, rppt, pasha.tatashin, pratyush, akpm
Cc: kexec, linux-mm, linux-kernel, ran.xiaokai, ranxiaokai627
From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
The following pr_warn() provides detailed error and location
information, WARN_ON(err) adds no additional debugging value,
so remove the redundant WARN_ON() call.
Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
---
kernel/liveupdate/kexec_handover.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index 76b714db175d..b851b09a8e99 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -1507,7 +1507,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
memblock_add(area->addr, size);
err = memblock_mark_kho_scratch(area->addr, size);
- if (WARN_ON(err)) {
+ if (err) {
pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %pe",
&area->addr, &size, ERR_PTR(err));
goto err_unmap_scratch;
--
2.25.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) in kho_populate()
2026-02-06 4:31 ` [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) " ranxiaokai627
@ 2026-02-07 17:34 ` Pasha Tatashin
2026-02-10 13:45 ` Pratyush Yadav
1 sibling, 0 replies; 7+ messages in thread
From: Pasha Tatashin @ 2026-02-07 17:34 UTC (permalink / raw)
To: ranxiaokai627
Cc: graf, rppt, pratyush, akpm, kexec, linux-mm, linux-kernel, ran.xiaokai
On Thu, Feb 5, 2026 at 11:31 PM <ranxiaokai627@163.com> wrote:
>
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> The following pr_warn() provides detailed error and location
> information, WARN_ON(err) adds no additional debugging value,
> so remove the redundant WARN_ON() call.
>
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
> ---
> kernel/liveupdate/kexec_handover.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index 76b714db175d..b851b09a8e99 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -1507,7 +1507,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fdt_len,
>
> memblock_add(area->addr, size);
> err = memblock_mark_kho_scratch(area->addr, size);
> - if (WARN_ON(err)) {
> + if (err) {
> pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %pe",
> &area->addr, &size, ERR_PTR(err));
> goto err_unmap_scratch;
> --
> 2.25.1
>
>
>
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 1/2] kho: fix missing early_memunmap() call in kho_populate()
2026-02-06 4:31 ` [PATCH -next 1/2] kho: fix missing early_memunmap() call " ranxiaokai627
@ 2026-02-10 13:45 ` Pratyush Yadav
2026-02-11 1:23 ` ranxiaokai627
0 siblings, 1 reply; 7+ messages in thread
From: Pratyush Yadav @ 2026-02-10 13:45 UTC (permalink / raw)
To: ranxiaokai627
Cc: graf, rppt, pasha.tatashin, pratyush, akpm, kexec, linux-mm,
linux-kernel, ran.xiaokai, stable
Hi Ran,
Thanks for the fix.
On Fri, Feb 06 2026, ranxiaokai627@163.com wrote:
> From: Ran Xiaokai <ran.xiaokai@zte.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@zte.com.cn>
> ---
>
> b50634c5e84a ("kho: cleanup error handling in kho_populate()")
> has not landed in upstream, so
> Cc: <stable@vger.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;
Nit: Please use a bool and true/false. I think it reads much nicer.
> 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:
Nit: now that this code can be reached by non-error paths, we should
re-name the labels. I think dropping the "err_" prefix should be enough.
With these fixed,
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
> - pr_warn("disabling KHO revival\n");
> + if (!populated)
> + pr_warn("disabling KHO revival\n");
> }
>
> /* Helper functions for kexec_file_load */
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) in kho_populate()
2026-02-06 4:31 ` [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) " ranxiaokai627
2026-02-07 17:34 ` Pasha Tatashin
@ 2026-02-10 13:45 ` Pratyush Yadav
1 sibling, 0 replies; 7+ messages in thread
From: Pratyush Yadav @ 2026-02-10 13:45 UTC (permalink / raw)
To: ranxiaokai627
Cc: graf, rppt, pasha.tatashin, pratyush, akpm, kexec, linux-mm,
linux-kernel, ran.xiaokai
On Fri, Feb 06 2026, ranxiaokai627@163.com wrote:
> From: Ran Xiaokai <ran.xiaokai@zte.com.cn>
>
> The following pr_warn() provides detailed error and location
> information, WARN_ON(err) adds no additional debugging value,
> so remove the redundant WARN_ON() call.
>
> Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
[...]
--
Regards,
Pratyush Yadav
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next 1/2] kho: fix missing early_memunmap() call in kho_populate()
2026-02-10 13:45 ` Pratyush Yadav
@ 2026-02-11 1:23 ` ranxiaokai627
0 siblings, 0 replies; 7+ messages in thread
From: ranxiaokai627 @ 2026-02-11 1:23 UTC (permalink / raw)
To: pratyush
Cc: akpm, graf, kexec, linux-kernel, linux-mm, pasha.tatashin,
ran.xiaokai, ranxiaokai627, rppt, stable
>Hi Ran,
>
>Thanks for the fix.
>
>On Fri, Feb 06 2026, ranxiaokai627@163.com wrote:
>
>> From: Ran Xiaokai <ran.xiaokai@zte.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@zte.com.cn>
>> ---
>>
>> b50634c5e84a ("kho: cleanup error handling in kho_populate()")
>> has not landed in upstream, so
>> Cc: <stable@vger.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;
>
>Nit: Please use a bool and true/false. I think it reads much nicer.
yes.
>> 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:
>
>Nit: now that this code can be reached by non-error paths, we should
>re-name the labels. I think dropping the "err_" prefix should be enough.
Thanks for your review.
Very helpful suggestion. I will send a v2.
>With these fixed,
>
>Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>
>> - pr_warn("disabling KHO revival\n");
>> + if (!populated)
>> + pr_warn("disabling KHO revival\n");
>> }
>>
>> /* Helper functions for kexec_file_load */
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-02-11 1:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-06 4:31 [PATCH -next 0/2] two fixes in kho_populate() ranxiaokai627
2026-02-06 4:31 ` [PATCH -next 1/2] kho: fix missing early_memunmap() call " ranxiaokai627
2026-02-10 13:45 ` Pratyush Yadav
2026-02-11 1:23 ` ranxiaokai627
2026-02-06 4:31 ` [PATCH -next 2/2] kho: remove unnecessary WARN_ON(err) " ranxiaokai627
2026-02-07 17:34 ` Pasha Tatashin
2026-02-10 13:45 ` Pratyush Yadav
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox