[PATCH v3 5/6] mm: Change ghes code to allow poison of non-struct PFN

From: ankita
Date: Wed Apr 05 2023 - 14:02:14 EST


From: Ankit Agrawal <ankita@xxxxxxxxxx>

The GHES code allows calling of memory_failure() on the PFNs that pass the
pfn_valid() check. This contract is broken for the remapped PFNs which
fails the check and ghes_do_memory_failure() returns without triggering
memory_failure().

Update code to allow memory_failure() call on PFNs failing pfn_valid().

Signed-off-by: Ankit Agrawal <ankita@xxxxxxxxxx>
---
drivers/acpi/apei/ghes.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 34ad071a64e9..2ab7fec8127d 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -459,20 +459,10 @@ static void ghes_kick_task_work(struct callback_head *head)

static bool ghes_do_memory_failure(u64 physical_addr, int flags)
{
- unsigned long pfn;
-
if (!IS_ENABLED(CONFIG_ACPI_APEI_MEMORY_FAILURE))
return false;

- pfn = PHYS_PFN(physical_addr);
- if (!pfn_valid(pfn) && !arch_is_platform_page(physical_addr)) {
- pr_warn_ratelimited(FW_WARN GHES_PFX
- "Invalid address in generic error data: %#llx\n",
- physical_addr);
- return false;
- }
-
- memory_failure_queue(pfn, flags);
+ memory_failure_queue(PHYS_PFN(physical_addr), flags);
return true;
}

--
2.17.1