[PATCH v4 0/2] cpufreq: acpi-cpufreq: fix P-state index mismatch between perf->states[] and freq_table[]
From: lirongqing
Date: Thu Sep 10 2026 - 07:21:47 EST
From: Li RongQing <lirongqing@xxxxxxxxx>
perf->state is an index into perf->states[], but freq_table[] is built by
skipping duplicate _PSS entries, so the two arrays no longer share an index
space. Using perf->state to index freq_table[] therefore reads the wrong
slot. This series fixes the two remaining places that do so.
Changes since v3:
- Reword patch 1 and patch 2 per Zhongqiu Han's review: replace "duplicate
frequencies" with "entries that are not lower in frequency than the previous
one" to match the actual dedup condition; expand the extract_io() retry
description to "sleeps through all 100 iterations - at least ~1 ms of
usleep_range() plus 100 cross-CPU calls and I/O port reads, all with
policy->rwsem held"; drop the trailing "through data->resume" from patch 2.
- Add Reviewed-by from Zhongqiu Han.
Changes since v2:
- Reword patch 1;
- Rewrite patch 2, using perf->state to index perf->states[] (its native
index space) instead of the deduplicated freq_table[]
- Fix the Fixes: tags to point at the actual commits that introduced each
Changes since v1:
- Reword patch 1: v1 described it as an out-of-bounds read, which is wrong;
it is an index-mismatch / wrong-result bug, not a memory-safety issue.
- Add patch 2 for get_cur_freq_on_cpu().
- Add Fixes: tags (not exact, but reasonable backport targets).
Li RongQing (2):
cpufreq: acpi-cpufreq: fix P-state index mismatch in extract_io()
cpufreq: acpi-cpufreq: fix P-state index mismatch in
get_cur_freq_on_cpu()
drivers/cpufreq/acpi-cpufreq.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
--
2.9.4