Skip to contentSkip to conversation

FAILED: Patch "of/kexec: refactor ima_get_kexec_buffer() to use ima_validate_range()" failed to apply to 6.1-stable tree

PATCH Sasha Levin 1 participant 1 message Mar 1

Subsystems (2)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 4d02233235ed0450de9c10fcdcf3484e3c9401ce Mon Sep 17 00:00:00 2001
From: Harshit Mogalapalli <[email protected]>
Date: Tue, 30 Dec 2025 22:16:08 -0800
Subject: [PATCH] of/kexec: refactor ima_get_kexec_buffer() to use
ima_validate_range()

Refactor the OF/DT ima_get_kexec_buffer() to use a generic helper to validate the address range. No functional change intended.

Cc Alexander Graf <[email protected]>
Cc Ard Biesheuvel <[email protected]>
Cc Baoquan He <[email protected]>
Cc Borislav Betkov <[email protected]>
Cc guoweikang <[email protected]>
Cc Henry Willard <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jiri Bohac <[email protected]>
Cc Joel Granados <[email protected]>
Cc Jonathan McDowell <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Paul Webb <[email protected]>
Cc Sohil Mehta <[email protected]>
Cc Sourabh Jain <[email protected]>
Cc Thomas Gleinxer <[email protected]>
Cc Yifei Liu <[email protected]>
---
 drivers/of/kexec.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/of/kexec.c +3 -12
index 1ee2d31816aeb..c4cf3552c0183 100644
@@ -128,7 +128,6 @@ int __init ima_get_kexec_buffer(void **addr, size_t *size)
 {
 	int ret, len;
 	unsigned long tmp_addr;
-	unsigned long start_pfn, end_pfn;
 	size_t tmp_size;
 	const void *prop;
 
@@ -144,17 +143,9 @@ int __init ima_get_kexec_buffer(void **addr, size_t *size)
 	if (!tmp_size)
 		return -ENOENT;
 
-	/*
-	 * Calculate the PFNs for the buffer and ensure
-	 * they are with in addressable memory.
-	 */
-	start_pfn = PHYS_PFN(tmp_addr);
-	end_pfn = PHYS_PFN(tmp_addr + tmp_size - 1);
-	if (!page_is_ram(start_pfn) || !page_is_ram(end_pfn)) {
-		pr_warn("IMA buffer at 0x%lx, size = 0x%zx beyond memory\n",
-			tmp_addr, tmp_size);
-		return -EINVAL;
-	}
+	ret = ima_validate_range(tmp_addr, tmp_size);
+	if (ret)
+		return ret;
 
 	*addr = __va(tmp_addr);
 	*size = tmp_size;
Signature · 1 line
2.51.0