aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2012-06-27 16:07:58 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2012-06-27 16:07:58 +0000
commitafea6800ce201481ac6ebace2b4266b3b1b15d6e (patch)
treedc82af2494ae0a10768425c714f62ecab93b1bb9
parent1e7eabd307e3c1452869cc800798dad75b1d138f (diff)
downloadsrc-afea6800ce201481ac6ebace2b4266b3b1b15d6e.tar.gz
src-afea6800ce201481ac6ebace2b4266b3b1b15d6e.zip
Do not malloc(9) while holding a spin lock, to avoid panic. Note it was
submitted upstream and it should be fixed in the next ACPICA release. Discussed with: Moore, Robert (robert dot moore at intel dot com)
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=237650
-rw-r--r--source/components/events/evxfgpe.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c
index daea88804ddb..750c46028fce 100644
--- a/source/components/events/evxfgpe.c
+++ b/source/components/events/evxfgpe.c
@@ -298,7 +298,7 @@ AcpiSetupGpeForWake (
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_NAMESPACE_NODE *DeviceNode;
- ACPI_GPE_NOTIFY_INFO *Notify;
+ ACPI_GPE_NOTIFY_INFO *NewNotify, *Notify;
ACPI_CPU_FLAGS Flags;
@@ -334,6 +334,12 @@ AcpiSetupGpeForWake (
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ NewNotify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO));
+ if (!NewNotify)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Ensure that we have a valid GPE number */
@@ -384,16 +390,10 @@ AcpiSetupGpeForWake (
/* Add this device to the notify list for this GPE */
- Notify = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_NOTIFY_INFO));
- if (!Notify)
- {
- Status = AE_NO_MEMORY;
- goto UnlockAndExit;
- }
-
- Notify->DeviceNode = DeviceNode;
- Notify->Next = GpeEventInfo->Dispatch.NotifyList;
- GpeEventInfo->Dispatch.NotifyList = Notify;
+ NewNotify->DeviceNode = DeviceNode;
+ NewNotify->Next = GpeEventInfo->Dispatch.NotifyList;
+ GpeEventInfo->Dispatch.NotifyList = NewNotify;
+ NewNotify = NULL;
}
/* Mark the GPE as a possible wake event */
@@ -403,6 +403,10 @@ AcpiSetupGpeForWake (
UnlockAndExit:
AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ if (NewNotify)
+ {
+ ACPI_FREE (NewNotify);
+ }
return_ACPI_STATUS (Status);
}