From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A25D3033D1 for ; Wed, 11 Feb 2026 09:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770802309; cv=none; b=NLzFhezKy3Mtt3KyF4Wfaa5brV4wntHnGCy3LDo4MTmKWPIyCRFjjbyWFDECd1MHCggsnlW6hv12MTK01zAv4mVXeGeU/EYfuMqKBBzYXifcIwzDhVV3FJKKgs4yd5t6K2vActO6y1mXtSqFQ7KdohplBLDyAH8FJkSINkfFuz0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770802309; c=relaxed/simple; bh=BohRPRiY3VE+/X8kSB1tjVdVbZoLXjZP2UZzgT4RPtI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=nCsr12cb4GhczVdbEgFTkxDr1+7oQTRiVrhtifXfN/72Pz1KhleMDDrPBVffwId/vlxyQIR79haC5lJTnPPyuSFOT1kZHo+QVHm88DkkJzbypJjaWhCx2kh4/YKv+3U6SM4h3cKIG5cgO1Wls+s60bo2tfqttNQQFYfxgT1Wlbg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JtJyX6PO; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JtJyX6PO" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E968C4CEF7; Wed, 11 Feb 2026 09:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770802309; bh=BohRPRiY3VE+/X8kSB1tjVdVbZoLXjZP2UZzgT4RPtI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=JtJyX6PORi1H5S7yfts2K92qjyIudjo1Q8JLoaiC3KIOs/Cqwib4Ng76J9VdM4rxA gC6DO/zlY3MQSnfUzi/7+2hiKjgfBB3y4mbOjnhKCxWfNlXSzC4Sm3RxD53i+vmKiM KbqMYkulTmZnk8Oj1FrYCeHF2SY6CX6Swi+puBCFg2j4BUc3IRS9+ZzSxeFBRv9t0T Ddzn/n9qOjY1ygk9t0kKLVfLbAbB8wblHYEIIgtacr7pSTrXq3UE7UizWu7qMgo+F3 tRH4j1AWvVvzFt+DkxR4WchbuX/UMm0qdupf3bKFNHY8ZziRGgBMxkKZA1CAP8Ou3r ta1sEcm3fEBsQ== From: Pratyush Yadav To: ranxiaokai627@163.com Cc: graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, akpm@linux-foundation.org, kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn Subject: Re: [PATCH v2 1/2] kho: fix missing early_memunmap() call in kho_populate() In-Reply-To: <20260211032937.208353-2-ranxiaokai627@163.com> (ranxiaokai's message of "Wed, 11 Feb 2026 03:29:36 +0000") References: <20260211032937.208353-1-ranxiaokai627@163.com> <20260211032937.208353-2-ranxiaokai627@163.com> Date: Wed, 11 Feb 2026 10:31:45 +0100 Message-ID: <2vxzy0kzr5ha.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Hi Ran, On Wed, Feb 11 2026, ranxiaokai627@163.com wrote: > From: Ran Xiaokai > > 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()") > Reviewed-by: Pratyush Yadav > Signed-off-by: Ran Xiaokai > --- > kernel/liveupdate/kexec_handover.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > index fb3a7b67676e..3c705b08a489 100644 > --- a/kernel/liveupdate/kexec_handover.c > +++ b/kernel/liveupdate/kexec_handover.c > @@ -1463,13 +1463,14 @@ 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; > + bool populated = false; > int err; > > /* Validate the input FDT */ > fdt = early_memremap(fdt_phys, fdt_len); > if (!fdt) { > pr_warn("setup: failed to memremap FDT (0x%llx)\n", fdt_phys); > - goto err_report; > + goto report; > } > err = fdt_check_header(fdt); > if (err) { > @@ -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 = true; > + pr_info("found kexec handover data.\n"); > > err_unmap_scratch: > early_memunmap(scratch, scratch_len); > err_unmap_fdt: > early_memunmap(fdt, fdt_len); I meant to say all these labels should be renamed, not just err_report. So "err_unmap_scratch" should be "unmap_scratch", and "err_unmap_fdt" should be "unmap_fdt". > -err_report: > - pr_warn("disabling KHO revival\n"); > +report: > + if (!populated) > + pr_warn("disabling KHO revival\n"); > } > > /* Helper functions for kexec_file_load */ -- Regards, Pratyush Yadav