diff options
| author | Seunghun Han <kkamagui@gmail.com> | 2017-07-18 20:03:51 +0900 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-08-16 21:00:43 +0200 |
| commit | ac510cc12922212034b14c42f7dee9c74a89e9f4 (patch) | |
| tree | 0a50a97e76d2984b8416855f37ab22c14cc01002 /arch/x86 | |
| parent | 40821b639b9cab91483f8e43fa5fb6a13b3dba89 (diff) | |
UPSTREAM: x86/acpi: Prevent out of bound access caused by broken ACPI tables
The bus_irq argument of mp_override_legacy_irq() is used as the index into
the isa_irq_to_gsi[] array. The bus_irq argument originates from
ACPI_MADT_TYPE_IO_APIC and ACPI_MADT_TYPE_INTERRUPT items in the ACPI
tables, but is nowhere sanity checked.
That allows broken or malicious ACPI tables to overwrite memory, which
might cause malfunction, panic or arbitrary code execution.
Add a sanity check and emit a warning when that triggers.
[ tglx: Added warning and rewrote changelog ]
Signed-off-by: Seunghun Han <kkamagui@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: security@kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: stable@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit dad5ab0db8deac535d03e3fe3d8f2892173fa6a4)
Bug: 64253928
Change-Id: I34c8305afb582298618cf8e6d889985134137265
Diffstat (limited to 'arch/x86')
| -rw-r--r-- | arch/x86/kernel/acpi/boot.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index 6c96b60fe..ebbf4223a 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c @@ -968,6 +968,14 @@ void __init mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger, u32 gsi) struct mpc_intsrc mp_irq; /* + * Check bus_irq boundary. + */ + if (bus_irq >= NR_IRQS_LEGACY) { + pr_warn("Invalid bus_irq %u for legacy override\n", bus_irq); + return; + } + + /* * Convert 'gsi' to 'ioapic.pin'. */ ioapic = mp_find_ioapic(gsi); |
