[PATCH] lib: acpica: make region handler more robust (LP: #1524217)

Colin King colin.king at canonical.com
Wed Dec 9 11:05:18 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

The region handler should sanity check for invalid parameters before
attempting to deference them to avoid segfaults.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpica/fwts_acpica.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/acpica/fwts_acpica.c b/src/acpica/fwts_acpica.c
index 3cf7676..3caeda9 100644
--- a/src/acpica/fwts_acpica.c
+++ b/src/acpica/fwts_acpica.c
@@ -261,6 +261,10 @@ static ACPI_STATUS fwts_region_handler(
 	ACPI_CONNECTION_INFO    *context;
 	int			i;
 
+	if (!regionobject)
+		return AE_BAD_PARAMETER;
+	if (!value)
+		return AE_BAD_PARAMETER;
 	if (regionobject->Region.Type != ACPI_TYPE_REGION)
 		return AE_OK;
 
@@ -306,6 +310,8 @@ static ACPI_STATUS fwts_region_handler(
 			case AML_FIELD_ATTRIB_MULTIBYTE:
 			case AML_FIELD_ATTRIB_RAW_BYTES:
 			case AML_FIELD_ATTRIB_RAW_PROCESS:
+				if (!context)
+					return AE_BAD_PARAMETER;
 				length = context->AccessLength - 2;
 				break;
 			default:
@@ -331,6 +337,8 @@ static ACPI_STATUS fwts_region_handler(
 			case AML_FIELD_ATTRIB_MULTIBYTE:
 			case AML_FIELD_ATTRIB_RAW_BYTES:
 			case AML_FIELD_ATTRIB_RAW_PROCESS:
+				if (!context)
+					return AE_BAD_PARAMETER;
 				length = context->AccessLength - 2;
 				break;
 			default:
-- 
2.6.2




More information about the fwts-devel mailing list