public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ACPI: APEI: Avoid NULL pointer dereference in ghes_estatus_pool_region_free
@ 2026-02-03  2:12 Jiawen Wu
  2026-02-03 12:56 ` Rafael J. Wysocki
  2026-02-03 22:55 ` Bjorn Helgaas
  0 siblings, 2 replies; 9+ messages in thread
From: Jiawen Wu @ 2026-02-03  2:12 UTC (permalink / raw)
  To: Rafael J. Wysocki, Tony Luck, Borislav Petkov, Hanjun Guo,
	Mauro Carvalho Chehab, Shuai Xue, Len Brown, Shiju Jose,
	Bjorn Helgaas, linux-acpi, linux-kernel
  Cc: Jiawen Wu

The function ghes_estatus_pool_region_free() is exported and be called
by the PCIe AER recovery path, which unconditionally invokes it to free
aer_capability_regs memory.

Although current AER usage assumes memory comes from the GHES pool,
robustness requires guarding against pool unavailability. Add a NULL check
before calling gen_pool_free() to prevent crashes when the pool is not
initialized. This also makes the API safer for potential future use by
non-GHES callers.

Fixes: e2abc47a5a1a ("ACPI: APEI: Fix AER info corruption when error status data has multiple sections")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/acpi/apei/ghes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index 0dc767392a6c..e81c007464a9 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -236,7 +236,8 @@ int ghes_estatus_pool_init(unsigned int num_ghes)
  */
 void ghes_estatus_pool_region_free(unsigned long addr, u32 size)
 {
-	gen_pool_free(ghes_estatus_pool, addr, size);
+	if (ghes_estatus_pool)
+		gen_pool_free(ghes_estatus_pool, addr, size);
 }
 EXPORT_SYMBOL_GPL(ghes_estatus_pool_region_free);
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-02-06  8:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-03  2:12 [PATCH] ACPI: APEI: Avoid NULL pointer dereference in ghes_estatus_pool_region_free Jiawen Wu
2026-02-03 12:56 ` Rafael J. Wysocki
2026-02-04  1:52   ` Jiawen Wu
2026-02-03 22:55 ` Bjorn Helgaas
2026-02-04  2:03   ` Jiawen Wu
2026-02-04 21:46     ` Bjorn Helgaas
2026-02-05  3:11       ` Jiawen Wu
2026-02-05 15:39         ` Bjorn Helgaas
2026-02-06  8:15           ` Jiawen Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox