[tip:core/efi] x86, efi: Check table header length in efi_bgrt_init()

From: tip-bot for Jan Beulich
Date: Wed Nov 14 2012 - 12:34:31 EST


Commit-ID: 5d6d578c170bb280db5d4779f666e456f4f82ec5
Gitweb: http://git.kernel.org/tip/5d6d578c170bb280db5d4779f666e456f4f82ec5
Author: Jan Beulich <JBeulich@xxxxxxxx>
AuthorDate: Wed, 7 Nov 2012 16:46:08 +0000
Committer: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
CommitDate: Wed, 14 Nov 2012 08:49:34 -0800

x86, efi: Check table header length in efi_bgrt_init()

Header length should be validated for all ACPI tables before accessing
any non-header field.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Link: http://lkml.kernel.org/r/509A9E6002000078000A7079@xxxxxxxxxxxxxxxxxxxx
Acked-by: Matt Fleming <matt.fleming@xxxxxxxxx>
Signed-off-by: H. Peter Anvin <hpa@xxxxxxxxxxxxxxx>
---
arch/x86/platform/efi/efi-bgrt.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/platform/efi/efi-bgrt.c b/arch/x86/platform/efi/efi-bgrt.c
index f6a0c1b..d9c1b95 100644
--- a/arch/x86/platform/efi/efi-bgrt.c
+++ b/arch/x86/platform/efi/efi-bgrt.c
@@ -39,6 +39,8 @@ void efi_bgrt_init(void)
if (ACPI_FAILURE(status))
return;

+ if (bgrt_tab->header.length < sizeof(*bgrt_tab))
+ return;
if (bgrt_tab->version != 1)
return;
if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/