From nobody Thu Apr 2 01:48:16 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (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 646361400C for ; Thu, 12 Feb 2026 11:12:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770894775; cv=none; b=pY5YyZ0NCa+N3QvRcZk9rClonFVb3Wb9WHlnqIaA0fLdRo8cARp2O5HHaNNExktdz7A3xnRtbL19wkH2eiS5IuUCmsUi6pWqXRMPcHheH0gE7T13Wfsk4qmz8SbgukQcLSRJWsxCLaRcOkwh8l9O5c0C//MQszOeGHUljOSiHDU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770894775; c=relaxed/simple; bh=okuWd8z2kFd0rIffxvzQK6z+P/wpERsxKmU8WCPbXrM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H1F4hO8ZS0WlY7QkWWrl7yg/oSer0qwV+jgA52tcoYDmZCkzPThDPtDcquwg8nHIZZtSP4tbzbo5zJN9++xQx5VxPTJlOeV+LhX6dnvmEEfb1Kn9mklfac5265EE9nfzcrUUeuJJG2CO4hzyo1XkdTIiqqhAMW9YOHxbA8tMkCE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=dDM0Zc/J; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="dDM0Zc/J" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=Gg M6lCDjzNogkk3QpfIH7skqXJaQ5cQhN9X8oPB+HkM=; b=dDM0Zc/JV5DqMGaARJ s4AMvreH8VlIclJkp0F0PTUdrrtyYuBa1ZerR5Kz5I9LjgzlHnFP5yGB2zqC1lpv QiKhLD4HjYd1fL41jcYcJJIgaDB0juEu4k+NOelOCCb+S1mzqmHn00MTZ3T70b17 yJaRui2oIcOx+ue+4STSWHhDk= Received: from ubuntu24-z.. (unknown []) by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wCHZLl0tY1ptkijLg--.48890S3; Thu, 12 Feb 2026 19:11:51 +0800 (CST) From: ranxiaokai627@163.com To: graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, akpm@linux-foundation.org Cc: kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn, ranxiaokai627@163.com Subject: [PATCH v3 1/2] kho: fix missing early_memunmap() call in kho_populate() Date: Thu, 12 Feb 2026 11:11:45 +0000 Message-ID: <20260212111146.210086-2-ranxiaokai627@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212111146.210086-1-ranxiaokai627@163.com> References: <20260212111146.210086-1-ranxiaokai627@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wCHZLl0tY1ptkijLg--.48890S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxZry8Gw4rWry8KF1rGr13CFg_yoW5Wr4fpF ySg3s3Cw48tayYq3y7Ja10g345trZ5t3W3tayUCryfJrnFvFnxA3yxt3Wvyr42qr9aqw1U KF40vayrWw1UAFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0z_NtxJUUUUU= X-CM-SenderInfo: xudq5x5drntxqwsxqiywtou0bp/xtbCxRdIlGmNtXeS8QAA3L Content-Type: text/plain; charset="utf-8" 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()") Signed-off-by: Ran Xiaokai Reviewed-by: Pratyush Yadav --- kernel/liveupdate/kexec_handover.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_h= andover.c index fb3a7b67676e..af82d8862dd7 100644 --- a/kernel/liveupdate/kexec_handover.c +++ b/kernel/liveupdate/kexec_handover.c @@ -1463,36 +1463,37 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 = fdt_len, struct kho_scratch *scratch =3D NULL; phys_addr_t mem_map_phys; void *fdt =3D NULL; + bool populated =3D false; int err; =20 /* Validate the input FDT */ fdt =3D 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 =3D fdt_check_header(fdt); if (err) { pr_warn("setup: handover FDT (0x%llx) is invalid: %d\n", fdt_phys, err); - goto err_unmap_fdt; + goto unmap_fdt; } err =3D fdt_node_check_compatible(fdt, 0, KHO_FDT_COMPATIBLE); if (err) { pr_warn("setup: handover FDT (0x%llx) is incompatible with '%s': %d\n", fdt_phys, KHO_FDT_COMPATIBLE, err); - goto err_unmap_fdt; + goto unmap_fdt; } =20 mem_map_phys =3D kho_get_mem_map_phys(fdt); if (!mem_map_phys) - goto err_unmap_fdt; + goto unmap_fdt; =20 scratch =3D early_memremap(scratch_phys, scratch_len); if (!scratch) { pr_warn("setup: failed to memremap scratch (phys=3D0x%llx, len=3D%lld)\n= ", scratch_phys, scratch_len); - goto err_unmap_fdt; + goto unmap_fdt; } =20 /* @@ -1509,7 +1510,7 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 fd= t_len, if (WARN_ON(err)) { pr_warn("failed to mark the scratch region 0x%pa+0x%pa: %pe", &area->addr, &size, ERR_PTR(err)); - goto err_unmap_scratch; + goto unmap_scratch; } pr_debug("Marked 0x%pa+0x%pa as scratch", &area->addr, &size); } @@ -1529,16 +1530,17 @@ void __init kho_populate(phys_addr_t fdt_phys, u64 = fdt_len, kho_in.scratch_phys =3D scratch_phys; kho_in.mem_map_phys =3D mem_map_phys; kho_scratch_cnt =3D scratch_cnt; - pr_info("found kexec handover data.\n"); =20 - return; + populated =3D true; + pr_info("found kexec handover data.\n"); =20 -err_unmap_scratch: +unmap_scratch: early_memunmap(scratch, scratch_len); -err_unmap_fdt: +unmap_fdt: early_memunmap(fdt, fdt_len); -err_report: - pr_warn("disabling KHO revival\n"); +report: + if (!populated) + pr_warn("disabling KHO revival\n"); } =20 /* Helper functions for kexec_file_load */ --=20 2.25.1 From nobody Thu Apr 2 01:48:16 2026 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.5]) (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 E93DC1400C for ; Thu, 12 Feb 2026 11:13:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770894802; cv=none; b=nvPNI+1ERIpm4wBsJpxgVnoJf5t2Oq9PXWYX9xDkMhFk8Wjvi1lP8AOouqT42apbInpqDvczT6pxqMi7QjJBBo5rUenezazjoSDdYkLqSmz2Y/6Gj7W6yiSkhwM79XMNAqnGPKZ3u4I202nUIXqq11x5FljWOwEogZvuunKd1f4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770894802; c=relaxed/simple; bh=I5v+rKQVud0+RihQamKzYIedbG7RLtFpdcOBlTzWPD4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aGNUG1NgqnA0/YSz6mqJF9QXpsxP9KarpJ7YkXJ8p2956V1TJ8c4MQK3N2Nl+0ZWD3qWkuNB0e32AV51uwjv8FuuCrtKRvMGheXoQWmFiedT2q039YacJXiSTe6SBsPL1BVEVUqjOxXXxRwM8IoDq2wmuwdckAyxAtXAkllA5Ek= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=FVCG87nM; arc=none smtp.client-ip=220.197.31.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="FVCG87nM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=n+ rpPjxDD+Z5fIPDrZeUxPDcng3MFwzbjG+nEfu3iEU=; b=FVCG87nMyScfOr2n5l gVJn1xmndnPEpSJOd1HeBD+VoNDjwqFhPuIiZs02qMOAur+ctfVt2Di422iUdDMf acEY50DaM1RBFpPWIZj4G1ixY6QE4YGIgJnl42SgEhGOziay12m+KwPV4JWbCSJZ XyIDiF6ryBnXOyP1cbIXHzMFk= Received: from ubuntu24-z.. (unknown []) by gzga-smtp-mtada-g0-3 (Coremail) with SMTP id _____wCHZLl0tY1ptkijLg--.48890S4; Thu, 12 Feb 2026 19:11:53 +0800 (CST) From: ranxiaokai627@163.com To: graf@amazon.com, rppt@kernel.org, pasha.tatashin@soleen.com, pratyush@kernel.org, akpm@linux-foundation.org Cc: kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ran.xiaokai@zte.com.cn, ranxiaokai627@163.com Subject: [PATCH v3 2/2] kho: remove unnecessary WARN_ON(err) in kho_populate() Date: Thu, 12 Feb 2026 11:11:46 +0000 Message-ID: <20260212111146.210086-3-ranxiaokai627@163.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260212111146.210086-1-ranxiaokai627@163.com> References: <20260212111146.210086-1-ranxiaokai627@163.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wCHZLl0tY1ptkijLg--.48890S4 X-Coremail-Antispam: 1Uf129KBjvdXoWrtw1xXw17Cw4DGFW8XF4Dtwb_yoWDKrc_WF 4xtw1vkr4qvrn0vr1Yk39avFWrKw40qFyqv3W3JFyxt3W5tayj9a9xZr4DAFnxW34vkryD Arn0grZ8tr4fWjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7xRAJ5rDUUUUU== X-CM-SenderInfo: xudq5x5drntxqwsxqiywtou0bp/xtbC7RlJlWmNtXkzNQAA3G Content-Type: text/plain; charset="utf-8" From: Ran Xiaokai 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 Reviewed-by: Pratyush Yadav Reviewed-by: Pasha Tatashin --- 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_h= andover.c index af82d8862dd7..95601623b4d6 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 fd= t_len, =20 memblock_add(area->addr, size); err =3D 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 unmap_scratch; --=20 2.25.1