From: ranxiaokai627@163.com
To: pratyush@kernel.org
Cc: akpm@linux-foundation.org, graf@amazon.com,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, pasha.tatashin@soleen.com,
ran.xiaokai@zte.com.cn, ranxiaokai627@163.com, rppt@kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH -next 1/2] kho: fix missing early_memunmap() call in kho_populate()
Date: Wed, 11 Feb 2026 01:23:46 +0000 [thread overview]
Message-ID: <20260211012346.208225-1-ranxiaokai627@163.com> (raw)
In-Reply-To: <2vxzv7g4sof5.fsf@kernel.org>
>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 */
next prev parent reply other threads:[~2026-02-11 1:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 4:31 [PATCH -next 0/2] two fixes " 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 [this message]
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
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=20260211012346.208225-1-ranxiaokai627@163.com \
--to=ranxiaokai627@163.com \
--cc=akpm@linux-foundation.org \
--cc=graf@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=ran.xiaokai@zte.com.cn \
--cc=rppt@kernel.org \
--cc=stable@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