aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Gleixner <[email protected]>2024-02-13 22:05:57 +0100
committerThomas Gleixner <[email protected]>2024-02-15 22:07:43 +0100
commit7cdcdab1a660bbe9f98bf1591c048ce7ccee59e0 (patch)
tree8085a1efc8186dcb1d5ead2fec062f4da965e711
parentf1f758a80516775b5d12d7c93cbedb2a08cd4c98 (diff)
x86/cpu/topology: Reject unknown APIC IDs on ACPI hotplug
The topology bitmaps track all possible APIC IDs which have been registered during enumeration. As sizing and further topology information is going to be derived from these bitmaps, reject attempts to hotplug an APIC ID which was not registered during enumeration. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Michael Kelley <[email protected]> Tested-by: Sohil Mehta <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/x86/kernel/cpu/topology.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c
index c67120657e55..a6d045b15ebd 100644
--- a/arch/x86/kernel/cpu/topology.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -272,6 +272,10 @@ int topology_hotplug_apic(u32 apic_id, u32 acpi_id)
if (apic_id >= MAX_LOCAL_APIC)
return -EINVAL;
+ /* Reject if the APIC ID was not registered during enumeration. */
+ if (!test_bit(apic_id, apic_maps[TOPO_SMT_DOMAIN].map))
+ return -ENODEV;
+
cpu = topo_lookup_cpuid(apic_id);
if (cpu < 0) {
if (topo_info.nr_assigned_cpus >= nr_cpu_ids)