All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/EFI: additional checks in efi_bgrt_init()
@ 2012-11-05 15:26 Jan Beulich
       [not found] ` <5097E8C102000078000A661B-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Beulich @ 2012-11-05 15:26 UTC (permalink / raw)
  To: josh-iaAMLnmF4UmaiuxdJuQwMA, mjg-H+wXaHxf7aLQT0dZR+AlfA
  Cc: mingo-X9Un+BFzKDI, tglx-hfZtesqFncYOwBW4kG4KsQ,
	linux-efi-u79uwXL29TY76Z2rM5mHXA, hpa-YMNOUZJC4hwAvxtiuMwx3w

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

The valid flags should also be check, as with it clear there's no point
in trying to go through the rest of the code (and there's no guarantee
that the other table contents are valid/consistent in that case).

Signed-off-by: Jan Beulich <jbeulich-IBi9RG/b67k@public.gmane.org>

---
 arch/x86/platform/efi/efi-bgrt.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- 3.7-rc4/arch/x86/platform/efi/efi-bgrt.c
+++ 3.7-rc4-x86-EFI-BGRT-checks/arch/x86/platform/efi/efi-bgrt.c
@@ -39,7 +39,9 @@ void efi_bgrt_init(void)
 	if (ACPI_FAILURE(status))
 		return;
 
-	if (bgrt_tab->version != 1)
+	if (bgrt_tab->header.length < sizeof(*bgrt_tab))
+		return;
+	if (bgrt_tab->version != 1 || !(bgrt_tab->status & 1))
 		return;
 	if (bgrt_tab->image_type != 0 || !bgrt_tab->image_address)
 		return;

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

end of thread, other threads:[~2012-11-07 14:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 15:26 [PATCH] x86/EFI: additional checks in efi_bgrt_init() Jan Beulich
     [not found] ` <5097E8C102000078000A661B-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
2012-11-05 18:37   ` Josh Triplett
2012-11-05 18:43     ` Matthew Garrett
     [not found]       ` <20121105184346.GA13508-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>
2012-11-05 19:00         ` Josh Triplett
2012-11-06  8:57           ` Jan Beulich
     [not found]             ` <5098DEF202000078000A695F-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
2012-11-06 12:55               ` Josh Triplett
2012-11-06 13:37                 ` Jan Beulich
     [not found]                   ` <5099209602000078000A6B3C-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
2012-11-06 16:16                     ` Josh Triplett
2012-11-07 14:48           ` Jan Beulich
     [not found]             ` <509A82E402000078000A6FC8-ce6RLXgGx+vWGUEhTRrCg1aTQe2KTcn/@public.gmane.org>
2012-11-07 14:52               ` Matthew Garrett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.