linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/acpi: Prevent X2APIC id 0xffffffff from being accounted
@ 2018-04-12  1:40 Dou Liyang
  2018-04-17 10:00 ` [tip:x86/urgent] " tip-bot for Dou Liyang
  0 siblings, 1 reply; 2+ messages in thread
From: Dou Liyang @ 2018-04-12  1:40 UTC (permalink / raw)
  To: x86, linux-kernel; +Cc: tglx, mingo, hpa, rjw, len.brown, Dou Liyang

RongQing reported that there are some X2APIC id 0xffffffff in his machine's
ACPI MADT table, which made the number of possible CPU inaccuracy.

The reason is that the ACPI X2APIC parser has no sanity check for
apicid 0xffffffff, which is an invalid id in all APIC types. See
"Intel® 64 Architecture x2APIC Specification", Chapter 2.4.1.

Add a sanity check to acpi_parse_x2apic() which ignores the invalid id.

Reported-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
 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 dde444f932c1..3b20607d581b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -215,6 +215,10 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 	apic_id = processor->local_apic_id;
 	enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 
+	/* Ignore invalid ID */
+	if (apic_id == 0xffffffff)
+		return 0;
+
 	/*
 	 * We need to register disabled CPU as well to permit
 	 * counting disabled CPUs. This allows us to size
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:x86/urgent] x86/acpi: Prevent X2APIC id 0xffffffff from being accounted
  2018-04-12  1:40 [PATCH] x86/acpi: Prevent X2APIC id 0xffffffff from being accounted Dou Liyang
@ 2018-04-17 10:00 ` tip-bot for Dou Liyang
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Dou Liyang @ 2018-04-17 10:00 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: hpa, linux-kernel, tglx, lirongqing, mingo, douly.fnst

Commit-ID:  10daf10ab154e31237a8c07242be3063fb6a9bf4
Gitweb:     https://git.kernel.org/tip/10daf10ab154e31237a8c07242be3063fb6a9bf4
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Thu, 12 Apr 2018 09:40:52 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 17 Apr 2018 11:56:31 +0200

x86/acpi: Prevent X2APIC id 0xffffffff from being accounted

RongQing reported that there are some X2APIC id 0xffffffff in his machine's
ACPI MADT table, which makes the number of possible CPU inaccurate.

The reason is that the ACPI X2APIC parser has no sanity check for APIC ID
0xffffffff, which is an invalid id in all APIC types. See "Intel® 64
Architecture x2APIC Specification", Chapter 2.4.1.

Add a sanity check to acpi_parse_x2apic() which ignores the invalid id.

Reported-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Cc: len.brown@intel.com
Cc: rjw@rjwysocki.net
Cc: hpa@zytor.com
Link: https://lkml.kernel.org/r/20180412014052.25186-1-douly.fnst@cn.fujitsu.com

---
 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 dde444f932c1..3b20607d581b 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -215,6 +215,10 @@ acpi_parse_x2apic(struct acpi_subtable_header *header, const unsigned long end)
 	apic_id = processor->local_apic_id;
 	enabled = processor->lapic_flags & ACPI_MADT_ENABLED;
 
+	/* Ignore invalid ID */
+	if (apic_id == 0xffffffff)
+		return 0;
+
 	/*
 	 * We need to register disabled CPU as well to permit
 	 * counting disabled CPUs. This allows us to size

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-17 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12  1:40 [PATCH] x86/acpi: Prevent X2APIC id 0xffffffff from being accounted Dou Liyang
2018-04-17 10:00 ` [tip:x86/urgent] " tip-bot for Dou Liyang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).