summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen.c.accardi@intel.com>2026-09-24 12:36:24 -0700
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2026-10-07 13:06:34 +0300
commit63f08f09d30e7040f247f3abaddef9a3409f291e (patch)
tree6fa1aa76b6b17ca8c0b0514b1e56bb78c1e02508 /include/linux
parentb56a9130a6c45c68d6903dc6e47688d1a97ae193 (diff)
downloadlinux-next-63f08f09d30e7040f247f3abaddef9a3409f291e.tar.gz
linux-next-63f08f09d30e7040f247f3abaddef9a3409f291e.zip
platform/x86/intel: power-domains: Handle failed init in tpmi_get_linux_die_id()
tpmi_init() returns early with -ENODEV on CPU models that are not in tpmi_cpu_ids, before domain_die_map is allocated. When the driver is built in, tpmi_get_linux_die_id() remains callable after the failed init and dereferences the NULL domain_die_map. This is reachable from user space: uncore-frequency-tpmi calls tpmi_get_linux_die_id() from the show function of the world-readable die_id sysfs attribute. The attribute is created on multi-die packages for clusters with the core agent type, so reading it on such a CPU that is missing from tpmi_cpu_ids oopses. Likewise, if cpuhp_setup_state() fails, the error path frees domain_die_map but leaves the pointer set, so a later call would read freed memory. Return -ENODEV when the map was not allocated, and clear the pointer wherever it is freed. tpmi_get_linux_cpu_number(), tpmi_get_punit_core_number() and tpmi_get_power_domain_id() read only the static per-CPU data and hash table, so they are safe after a failed init. tpmi_get_power_domain_mask() has the same problem as this helper but no callers, so it is handled separately. Fixes: e37be5d85c60 ("platform/x86/intel: power-domains: Add interface to get Linux die ID") Assisted-by: LLM Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Link: https://patch.msgid.link/20260924193625.1830526-2-kristen.c.accardi@intel.com Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions