naccyde / rpms / systemd

Forked from rpms/systemd a year ago
Clone
9fc0f6
From d6987c081c5b0d1a2d9083b3d50fb78c63ab4904 Mon Sep 17 00:00:00 2001
9fc0f6
From: Kay Sievers <kay@vrfy.org>
9fc0f6
Date: Thu, 10 Oct 2013 01:38:11 +0200
9fc0f6
Subject: [PATCH] do not accept "garbage" from acpi firmware performance data
9fc0f6
 (FPDT)
9fc0f6
9fc0f6
00000000  46 42 50 54 38 00 00 00  02 00 30 02 00 00 00 00  |FBPT8.....0.....|
9fc0f6
00000010  23 45 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |#E..............|
9fc0f6
00000020  f5 6a 51 00 00 00 00 00  00 00 00 00 00 00 00 00  |.jQ.............|
9fc0f6
00000030  00 00 00 00 00 00 00 00  70 74 61 6c 58 00 00 00  |........ptalX...|
9fc0f6
---
9fc0f6
 src/shared/acpi-fpdt.c | 5 +++++
9fc0f6
 1 file changed, 5 insertions(+)
9fc0f6
9fc0f6
diff --git a/src/shared/acpi-fpdt.c b/src/shared/acpi-fpdt.c
9fc0f6
index af58c7c..75648b4 100644
9fc0f6
--- a/src/shared/acpi-fpdt.c
9fc0f6
+++ b/src/shared/acpi-fpdt.c
9fc0f6
@@ -146,6 +146,11 @@ int acpi_get_boot_usec(usec_t *loader_start, usec_t *loader_exit) {
9fc0f6
         if (brec.type != ACPI_FPDT_BOOT_REC)
9fc0f6
                 return -EINVAL;
9fc0f6
 
9fc0f6
+        if (brec.startup_start == 0 || brec.exit_services_exit < brec.startup_start)
9fc0f6
+                return -EINVAL;
9fc0f6
+        if (brec.exit_services_exit > NSEC_PER_HOUR)
9fc0f6
+                return -EINVAL;
9fc0f6
+
9fc0f6
         if (loader_start)
9fc0f6
                 *loader_start = brec.startup_start / 1000;
9fc0f6
         if (loader_exit)