summaryrefslogtreecommitdiff
path: root/source/components/utilities
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/utilities')
-rw-r--r--source/components/utilities/utalloc.c15
-rw-r--r--source/components/utilities/utcopy.c6
-rw-r--r--source/components/utilities/uttrack.c8
-rw-r--r--source/components/utilities/utxface.c27
-rw-r--r--source/components/utilities/utxfinit.c29
5 files changed, 75 insertions, 10 deletions
diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c
index 00345fcff..f97d65ac7 100644
--- a/source/components/utilities/utalloc.c
+++ b/source/components/utilities/utalloc.c
@@ -292,11 +292,16 @@ AcpiUtDeleteCaches (
/* Free memory lists */
- AcpiOsFree (AcpiGbl_GlobalList);
- AcpiGbl_GlobalList = NULL;
-
- AcpiOsFree (AcpiGbl_NsNodeList);
- AcpiGbl_NsNodeList = NULL;
+ if (AcpiGbl_GlobalList)
+ {
+ AcpiOsFree (AcpiGbl_GlobalList);
+ AcpiGbl_GlobalList = NULL;
+ }
+ if (AcpiGbl_NsNodeList)
+ {
+ AcpiOsFree (AcpiGbl_NsNodeList);
+ AcpiGbl_NsNodeList = NULL;
+ }
#endif
return (AE_OK);
diff --git a/source/components/utilities/utcopy.c b/source/components/utilities/utcopy.c
index 4ca33bcac..7312b0353 100644
--- a/source/components/utilities/utcopy.c
+++ b/source/components/utilities/utcopy.c
@@ -1135,5 +1135,11 @@ AcpiUtCopyIobjectToIobject (
Status = AcpiUtCopySimpleObject (SourceDesc, *DestDesc);
}
+ if (ACPI_FAILURE(Status))
+ {
+ AcpiUtDeleteObjectDesc (*DestDesc);
+ *DestDesc = NULL;
+ }
+
return_ACPI_STATUS (Status);
}
diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c
index df04aa3a5..74c8e7dbe 100644
--- a/source/components/utilities/uttrack.c
+++ b/source/components/utilities/uttrack.c
@@ -715,7 +715,7 @@ AcpiUtDumpAllocations (
UINT32 Component,
const char *Module)
{
- ACPI_DEBUG_MEM_BLOCK *Element;
+ ACPI_DEBUG_MEM_BLOCK *Element = NULL;
ACPI_DESCRIPTOR *Descriptor;
UINT32 NumOutstanding = 0;
UINT8 DescriptorType;
@@ -737,7 +737,11 @@ AcpiUtDumpAllocations (
return_VOID;
}
- Element = AcpiGbl_GlobalList->ListHead;
+ if (AcpiGbl_GlobalList != NULL)
+ {
+ Element = AcpiGbl_GlobalList->ListHead;
+ }
+
while (Element)
{
if ((Element->Component & Component) &&
diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c
index e915b8438..c6d7b7e0e 100644
--- a/source/components/utilities/utxface.c
+++ b/source/components/utilities/utxface.c
@@ -147,11 +147,19 @@ AcpiTerminate (
ACPI_FUNCTION_TRACE (AcpiTerminate);
- /* Just exit if subsystem is already shutdown */
+ /* Try to exit if subsystem is shutdown */
if (AcpiGbl_Shutdown)
{
ACPI_ERROR ((AE_INFO, "ACPI Subsystem is already terminated"));
+
+ /*
+ * Purge the local caches and terminate OS. Some of caches may be
+ * allocated as well as OS can be initialized even if subsystem is
+ * shutdown, see AcpiInitializeSubsystem() function.
+ */
+ (void) AcpiUtDeleteCaches ();
+ (void) AcpiOsTerminate ();
return_ACPI_STATUS (AE_OK);
}
@@ -260,6 +268,18 @@ AcpiGetSystemInfo (
return_ACPI_STATUS (Status);
}
+ /*
+ * If AcpiInitializeSubsystem routine was successfully executed and buffer
+ * can be allocated.
+ */
+
+ if (!(AcpiGbl_StartupFlags & ACPI_SUBSYSTEM_INITIALIZE) &&
+ ((OutBuffer->Length == ACPI_ALLOCATE_BUFFER) ||
+ (OutBuffer->Length == ACPI_ALLOCATE_LOCAL_BUFFER)))
+ {
+ return_ACPI_STATUS (AE_ERROR);
+ }
+
/* Validate/Allocate/Clear caller buffer */
Status = AcpiUtInitializeBuffer (OutBuffer, sizeof (ACPI_SYSTEM_INFO));
@@ -372,6 +392,11 @@ AcpiInstallInitializationHandler (
UINT32 Function)
{
+ if (!(AcpiGbl_StartupFlags & ACPI_SUBSYSTEM_INITIALIZE))
+ {
+ return (AE_ERROR);
+ }
+
if (!Handler)
{
return (AE_BAD_PARAMETER);
diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c
index b9b1326cc..5a100bbd2 100644
--- a/source/components/utilities/utxfinit.c
+++ b/source/components/utilities/utxfinit.c
@@ -151,8 +151,11 @@ AcpiInitializeSubsystem (
ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
- AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
+ if (AcpiGbl_StartupFlags & ACPI_SUBSYSTEM_INITIALIZE)
+ {
+ return_ACPI_STATUS (AE_ERROR);
+ }
/* Initialize the OS-Dependent layer */
@@ -212,6 +215,8 @@ AcpiInitializeSubsystem (
}
#endif
+ AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
+
return_ACPI_STATUS (AE_OK);
}
@@ -241,6 +246,11 @@ AcpiEnableSubsystem (
ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
+ if (AcpiGbl_StartupFlags ^ (ACPI_SUBSYSTEM_INITIALIZE | ACPI_LOAD_TABLE))
+ {
+ return_ACPI_STATUS (AE_ERROR);
+ }
+
#if (!ACPI_REDUCED_HARDWARE)
/* Enable ACPI mode */
@@ -304,6 +314,14 @@ AcpiEnableSubsystem (
* initialization control methods are run (_REG, _STA, _INI) on the
* entire namespace.
*/
+
+ /* Make sure events are not already initialized */
+
+ if (AcpiGbl_EventsInitialized == TRUE)
+ {
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
if (!(Flags & ACPI_NO_EVENT_INIT))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -334,10 +352,12 @@ AcpiEnableSubsystem (
#endif /* !ACPI_REDUCED_HARDWARE */
+ AcpiGbl_StartupFlags |= ACPI_SUBSYSTEM_ENABLE;
+
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
+ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
/*******************************************************************************
@@ -362,6 +382,11 @@ AcpiInitializeObjects (
ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
+ if (AcpiGbl_StartupFlags ^ (ACPI_SUBSYSTEM_INITIALIZE | ACPI_LOAD_TABLE |
+ ACPI_SUBSYSTEM_ENABLE))
+ {
+ return_ACPI_STATUS (AE_ERROR);
+ }
/*
* Run all _REG methods