From nobody Fri Dec 19 17:35:49 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37FFEC41513 for ; Mon, 7 Aug 2023 13:55:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234654AbjHGNz3 (ORCPT ); Mon, 7 Aug 2023 09:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234676AbjHGNyN (ORCPT ); Mon, 7 Aug 2023 09:54:13 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D3B1FF9 for ; Mon, 7 Aug 2023 06:53:37 -0700 (PDT) Message-ID: <20230807135028.486658473@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1691416415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=ayByDUJuswmwRg+JdkqaUgq40LVH8XzK6wjgNRkT7J0=; b=V7FUOYfCvGD/WjL1hz+d+jUBSXqy1DJhVjHBHvlzWOx49ih7b+z8Pe3Z5+uLkAELFVl/aR VLKGsCcHj34BJlnqR5RDMZ1G2mHnq1aXUy77opzwjEHaEZmtgJSHnmPhVV91PDEk5Osb7X jVvDcPmKMcXpoByMER5MJm/invKurM1RilwsHT4VeAZwf0ivX23u+nmuOLqTgqx8hfe44a ZbmxmVPuA8S4dsg1AwZz4njC5k+jn2ZXXhJbkaYgoQxh4PiWVL6eZKOlGJBn3uZubIOITV eoasm/VSvYTd2og0tWmh7RsW0pN495wgIiogjUx/RoS5OAwfUBXiHIMdCNfsFA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1691416415; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: references:references; bh=ayByDUJuswmwRg+JdkqaUgq40LVH8XzK6wjgNRkT7J0=; b=Xs3/S9inXz+zznJfqErs4MVyDfMdQjvATNjIst7qOCoxxN5ZOTE9gFe1rO+DqQWh+O9/zy gWZ28HkVx5sWbfDA== From: Thomas Gleixner To: LKML Cc: x86@kernel.org, Tom Lendacky , Andrew Cooper , Arjan van de Ven , Huang Rui , Juergen Gross , Dimitri Sivanich , Michael Kelley , Sohil Mehta , K Prateek Nayak , Kan Liang , Zhang Rui , "Paul E. McKenney" , Feng Tang , Andy Shevchenko Subject: [patch 39/53] x86/cpu/topology: Reject unknown APIC IDs on ACPI hotplug References: <20230807130108.853357011@linutronix.de> MIME-Version: 1.0 Date: Mon, 7 Aug 2023 15:53:34 +0200 (CEST) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- arch/x86/kernel/cpu/topology.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -237,6 +237,10 @@ int topology_hotplug_apic(u32 apic_id, u if (apic_id >=3D MAX_LOCAL_APIC) return -EINVAL; =20 + /* Reject if the APIC ID was not registered during enumeration. */ + if (!test_bit(apic_id, apic_maps[TOPO_SMT_DOMAIN].map)) + return -ENODEV; + cpu =3D topo_lookup_cpuid(apic_id); if (cpu < 0) { if (topo_info.nr_assigned_cpus >=3D nr_cpu_ids)