Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757958AbcJHHpU (ORCPT ); Sat, 8 Oct 2016 03:45:20 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:36095 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754364AbcJHHpG (ORCPT ); Sat, 8 Oct 2016 03:45:06 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="11729249" From: Dou Liyang To: , , , CC: , , , Subject: [PATCH 1/2] x86/acpi: Fix the local APIC id validation in case of 0xff Date: Sat, 8 Oct 2016 15:44:36 +0800 Message-ID: <1475912677-19190-2-git-send-email-douly.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1475912677-19190-1-git-send-email-douly.fnst@cn.fujitsu.com> References: <1475912677-19190-1-git-send-email-douly.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.167.226.106] X-yoursite-MailScanner-ID: F1220466F726.AEDFD X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: douly.fnst@cn.fujitsu.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 901 Lines: 32 In MADT, the 0xff is an invalid local APIC id. When the kernel uses both the local APIC id and x2apic id, it may affect x2apic. Only add validation when the kernel parse the local APIC ids. Reported-by: Yinghai Lu Signed-off-by: Dou Liyang --- arch/x86/kernel/acpi/boot.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 32a7d70..d642c95 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -233,6 +233,10 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end) acpi_table_print_madt_entry(header); + /* the 0xff is an invalid local APIC id */ + if (processor->id == 0xff) + return -EINVAL; + /* * We need to register disabled CPU as well to permit * counting disabled CPUs. This allows us to size -- 2.5.5