[PATCH 01/10] thermal: intel: hfi: Pass byte size to alloc_pages_exact() and free_pages_exact()
From: Lee Jones
Date: Thu Dec 03 2026 - 14:55:48 EST
intel_hfi_online() passes hfi_features.nr_table_pages (a page count) to
alloc_pages_exact() and free_pages_exact() instead of the table size in
bytes. When CPUID leaf 6 enumerates more than one HFI table page, only
a single page is allocated, allowing hardware writes via
MSR_IA32_HW_FEEDBACK_PTR to corrupt adjacent physical memory and
intel_hfi_process_event() to read out of bounds.
Convert the page count to bytes using hfi_features.nr_table_pages <<
PAGE_SHIFT, matching the local_table allocation.
Fixes: 2d74e6319abe ("thermal: intel: hfi: Handle CPU hotplug events")
Closes: https://sashiko.dev/#/bug/linux-213cb649-d604-43fc-b43b-8cb453a252d6
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/thermal/intel/intel_hfi.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/intel/intel_hfi.c b/drivers/thermal/intel/intel_hfi.c
index 8ff094eccbaf..19355679c1df 100644
--- a/drivers/thermal/intel/intel_hfi.c
+++ b/drivers/thermal/intel/intel_hfi.c
@@ -470,7 +470,7 @@ void intel_hfi_online(unsigned int cpu)
* even after having been reprogrammed. Keep using the same pages. Do
* not free them.
*/
- hfi_instance->hw_table = alloc_pages_exact(hfi_features.nr_table_pages,
+ hfi_instance->hw_table = alloc_pages_exact(hfi_features.nr_table_pages << PAGE_SHIFT,
GFP_KERNEL | __GFP_ZERO);
if (!hfi_instance->hw_table)
goto unlock;
@@ -508,7 +508,8 @@ void intel_hfi_online(unsigned int cpu)
return;
free_hw_table:
- free_pages_exact(hfi_instance->hw_table, hfi_features.nr_table_pages);
+ free_pages_exact(hfi_instance->hw_table,
+ hfi_features.nr_table_pages << PAGE_SHIFT);
goto unlock;
}
--
2.56.1.911.g883d8bcb20-goog