From patchwork Wed Jul 1 02:29:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Ming X-Patchwork-Id: 33388 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n612SPgb019984 for ; Wed, 1 Jul 2009 02:28:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752342AbZGAC2V (ORCPT ); Tue, 30 Jun 2009 22:28:21 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752974AbZGAC2V (ORCPT ); Tue, 30 Jun 2009 22:28:21 -0400 Received: from mga11.intel.com ([192.55.52.93]:16849 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752342AbZGAC2U (ORCPT ); Tue, 30 Jun 2009 22:28:20 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 30 Jun 2009 19:20:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.42,320,1243839600"; d="scan'208";a="471029828" Received: from minggr.sh.intel.com (HELO [10.239.13.35]) ([10.239.13.35]) by fmsmga002.fm.intel.com with ESMTP; 30 Jun 2009 19:22:00 -0700 Subject: [PATCH] ACPICA: Revert "ACPICA: Remove obsolete acpi_os_validate_address interface" From: Lin Ming To: Len Brown Cc: Thomas Renninger , "Moore, Robert" , Zhao Yakui , linux-acpi Date: Wed, 01 Jul 2009 10:29:51 +0800 Message-Id: <1246415391.24831.30.camel@minggr.sh.intel.com> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1 (2.24.1-2.fc10) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Revert "ACPICA: Remove obsolete acpi_os_validate_address interface" This reverts commit f9ca058430333c9a24c5ca926aa445125f88df18. The quick fix of bug 13620 would be to revert the change. http://bugzilla.kernel.org/show_bug.cgi?id=13620 Also, see the commit df92e695998e1bc6e426a840eb86d6d1ee87e2a5 "ACPI: track opregion names to avoid driver resource conflicts." But there are problems we need to address: 1. We need to enhance the mechanism of avoiding driver resource conflicts to base a "resource" on Field definitions instead of Operation Region definitions. 2. For dynamic region, we need an interface to call when an operation region (field) is deleted, in order to delete it from the resource list. 3. If the same region is created and added to resource list over and over again, this is have the potential to be a memory leak by growing the list every time CC: Thomas Renninger Signed-off-by: Lin Ming Signed-off-by: Zhao Yakui --- drivers/acpi/acpica/acobject.h | 1 + drivers/acpi/acpica/dsopcode.c | 24 ++++++++++++++++++++++++ drivers/acpi/acpica/exfldio.c | 6 ++++++ include/acpi/acpiosxf.h | 4 ++++ 4 files changed, 35 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/acpica/acobject.h b/drivers/acpi/acpica/acobject.h index 544dcf8..eb6f038 100644 --- a/drivers/acpi/acpica/acobject.h +++ b/drivers/acpi/acpica/acobject.h @@ -97,6 +97,7 @@ #define AOPOBJ_OBJECT_INITIALIZED 0x08 #define AOPOBJ_SETUP_COMPLETE 0x10 #define AOPOBJ_SINGLE_DATUM 0x20 +#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an op_region address */ /****************************************************************************** * diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c index 584d766..b79978f 100644 --- a/drivers/acpi/acpica/dsopcode.c +++ b/drivers/acpi/acpica/dsopcode.c @@ -397,6 +397,30 @@ acpi_status acpi_ds_get_region_arguments(union acpi_operand_object *obj_desc) status = acpi_ds_execute_arguments(node, acpi_ns_get_parent_node(node), extra_desc->extra.aml_length, extra_desc->extra.aml_start); + if (ACPI_FAILURE(status)) { + return_ACPI_STATUS(status); + } + + /* Validate the region address/length via the host OS */ + + status = acpi_os_validate_address(obj_desc->region.space_id, + obj_desc->region.address, + (acpi_size) obj_desc->region.length, + acpi_ut_get_node_name(node)); + + if (ACPI_FAILURE(status)) { + /* + * Invalid address/length. We will emit an error message and mark + * the region as invalid, so that it will cause an additional error if + * it is ever used. Then return AE_OK. + */ + ACPI_EXCEPTION((AE_INFO, status, + "During address validation of OpRegion [%4.4s]", + node->name.ascii)); + obj_desc->common.flags |= AOPOBJ_INVALID; + status = AE_OK; + } + return_ACPI_STATUS(status); } diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c index d4075b8..6687be1 100644 --- a/drivers/acpi/acpica/exfldio.c +++ b/drivers/acpi/acpica/exfldio.c @@ -113,6 +113,12 @@ acpi_ex_setup_region(union acpi_operand_object *obj_desc, } } + /* Exit if Address/Length have been disallowed by the host OS */ + + if (rgn_desc->common.flags & AOPOBJ_INVALID) { + return_ACPI_STATUS(AE_AML_ILLEGAL_ADDRESS); + } + /* * Exit now for SMBus address space, it has a non-linear address space * and the request cannot be directly validated diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h index 3e79859..ab0b85c 100644 --- a/include/acpi/acpiosxf.h +++ b/include/acpi/acpiosxf.h @@ -242,6 +242,10 @@ acpi_os_derive_pci_id(acpi_handle rhandle, acpi_status acpi_os_validate_interface(char *interface); acpi_status acpi_osi_invalidate(char* interface); +acpi_status +acpi_os_validate_address(u8 space_id, acpi_physical_address address, + acpi_size length, char *name); + u64 acpi_os_get_timer(void); acpi_status acpi_os_signal(u32 function, void *info);