[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230614162112.122816-1-cymi20@fudan.edu.cn>
Date: Wed, 14 Jun 2023 09:21:12 -0700
From: Chenyuan Mi <cymi20@...an.edu.cn>
To: robert.moore@...el.com, rafael.j.wysocki@...el.com,
lenb@...nel.org, linux-acpi@...r.kernel.org,
acpica-devel@...ts.linuxfoundation.org,
linux-kernel@...r.kernel.org
Cc: Chenyuan Mi <cymi20@...an.edu.cn>
Subject: [PATCH] ACPICA: Fix missing check for return value of acpi_ns_get_attached_object()
The acpi_ns_get_attached_object() function may return
NULL, which may cause null pointer deference, and most
other callsites of acpi_ns_get_attached_object() do
Null check. Add Null check for return value of
acpi_ns_get_attached_object().
Found by our static analysis tool.
Signed-off-by: Chenyuan Mi <cymi20@...an.edu.cn>
---
drivers/acpi/acpica/exprep.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/acpi/acpica/exprep.c b/drivers/acpi/acpica/exprep.c
index 08196fa17080..d9c006ec1ac8 100644
--- a/drivers/acpi/acpica/exprep.c
+++ b/drivers/acpi/acpica/exprep.c
@@ -431,6 +431,13 @@ acpi_status acpi_ex_prep_field_value(struct acpi_create_field_info *info)
obj_desc->field.region_obj =
acpi_ns_get_attached_object(info->region_node);
+ if (!obj_desc->field.region_obj) {
+ ACPI_ERROR((AE_INFO,
+ "Null Region Object during field prep"));
+ acpi_ut_delete_object_desc(obj_desc);
+ return_ACPI_STATUS(AE_AML_INTERNAL);
+ }
+
/* Fields specific to generic_serial_bus fields */
obj_desc->field.access_length = info->access_length;
--
2.17.1
Powered by blists - more mailing lists