diff options
| author | Kristen Carlson Accardi <kristen.c.accardi@intel.com> | 2026-09-24 12:36:25 -0700 |
|---|---|---|
| committer | Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> | 2026-10-07 13:06:36 +0300 |
| commit | 359d85dd79530122bf44680494b0bc928de58a5f (patch) | |
| tree | 2189deb290c83c3439b59eb27075e9df42c335c4 /include/linux/platform_data | |
| parent | 63f08f09d30e7040f247f3abaddef9a3409f291e (diff) | |
| download | linux-next-359d85dd79530122bf44680494b0bc928de58a5f.tar.gz linux-next-359d85dd79530122bf44680494b0bc928de58a5f.zip | |
platform/x86/intel: power-domains: Handle failed init in tpmi_get_power_domain_mask()
tpmi_init() returns early on CPU models that are not in tpmi_cpu_ids,
before tpmi_power_domain_mask is allocated. When the driver is built
in, the exported tpmi_get_power_domain_mask() remains callable after
the failed init. It returns NULL then only because it indexes the NULL
array at offset 0 for the zeroed per-CPU data. If cpuhp_setup_state()
fails, the error path frees the array but leaves the pointer set, so
the helper would return a pointer into freed memory.
Nothing in the tree calls tpmi_get_power_domain_mask() today, so this
is hardening rather than a fix for a reachable bug. Return NULL when
the array was not allocated, and clear the pointer wherever it is
freed, as the previous patch does for domain_die_map.
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-3-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/platform_data')
0 files changed, 0 insertions, 0 deletions
