Blob Blame History Raw
From: Bob Moore <robert.moore@intel.com>
Date: Mon, 5 Jun 2017 16:40:50 +0800
Subject: ACPICA: Update resource descriptor handling
Patch-mainline: v4.14-rc1
Git-commit: 852d4f9c71bc1582199200310c8951b79e451d6a
References: bsc#1117419

ACPICA commit c8eac10178b387f9eb1935694e509d4518da77bb

This change restores the change introduced by commit 23b5bbe and
adds a comment concerning resource descriptor buffers that extend
beyond the END_TAG descriptor.

Link: https://github.com/acpica/acpica/commit/c8eac101
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lee, Chun-Yi <jlee@suse.com>
---
 drivers/acpi/acpica/utresrc.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--- a/drivers/acpi/acpica/utresrc.c
+++ b/drivers/acpi/acpica/utresrc.c
@@ -184,9 +184,11 @@ acpi_ut_walk_aml_resources(struct acpi_w
 
 	ACPI_FUNCTION_TRACE(ut_walk_aml_resources);
 
-	/* The absolute minimum resource template is one end_tag descriptor */
-
-	if (aml_length < sizeof(struct aml_resource_end_tag)) {
+	/*
+	 * The absolute minimum resource template is one end_tag descriptor.
+	 * However, we will treat a lone end_tag as just a simple buffer.
+	 */
+	if (aml_length <= sizeof(struct aml_resource_end_tag)) {
 		return_ACPI_STATUS(AE_AML_NO_RESOURCE_END_TAG);
 	}
 
@@ -243,8 +245,10 @@ acpi_ut_walk_aml_resources(struct acpi_w
 				*context = aml;
 			}
 
-			/* Normal exit */
-
+			/*
+			 * Normal exit. Note: We allow the buffer to be larger than
+			 * the resource template, as long as the END_TAG exists.
+			 */
 			return_ACPI_STATUS(AE_OK);
 		}