[PATCH v8 07/22] ACPI: APEI: GHES: free an estatus cache entry when no slot is found
From: Ahmed Tiba
Date: Thu Dec 03 2026 - 08:41:24 EST
ghes_estatus_cache_add() allocates a new cache entry before looking for a
slot. If every populated slot has a zero average period, the selection loop
can leave slot at -1. The unpublished entry and its allocation counter are
then leaked.
Return the entry to ghes_estatus_pool and balance the allocation counter
when no slot is selected.
Reported-by: sashiko-bot@xxxxxxxxxx
Link: https://sashiko.dev/#/message/20260617141000.8392A1F000E9%40smtp.kernel.org
Signed-off-by: Ahmed Tiba <ahmed.tiba@xxxxxxx>
---
drivers/acpi/apei/ghes.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
index d4ddf3c79216..b38806d205ab 100644
--- a/drivers/acpi/apei/ghes.c
+++ b/drivers/acpi/apei/ghes.c
@@ -1233,6 +1233,10 @@ ghes_estatus_cache_add(struct acpi_hest_generic *generic,
if (victim)
call_rcu(&unrcu_pointer(victim)->rcu,
ghes_estatus_cache_rcu_free);
+ } else {
+ gen_pool_free(ghes_estatus_pool, (unsigned long)new_cache,
+ GHES_ESTATUS_CACHE_LEN(new_cache->estatus_len));
+ atomic_dec(&ghes_estatus_cache_alloced);
}
}
--
2.43.0