summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2012-06-27 16:15:13 +0000
committerjkim <jkim@FreeBSD.org>2012-06-27 16:15:13 +0000
commitc42e49e4075ff907204f33fd48335013156105f9 (patch)
treecaba53e1a2d20f91e89900e7af6adf9472712395 /sys/contrib/dev
parent86ceb1784ac9f200299c75edb4e024b8f22df052 (diff)
downloadFreeBSD-src-c42e49e4075ff907204f33fd48335013156105f9.zip
FreeBSD-src-c42e49e4075ff907204f33fd48335013156105f9.tar.gz
MFV: r237650
Do not malloc(9) while holding a spin lock, to avoid panic. Reported by: kib (and many others) Tested by: kib (and many others)
Diffstat (limited to 'sys/contrib/dev')
-rw-r--r--sys/contrib/dev/acpica/components/events/evxfgpe.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/sys/contrib/dev/acpica/components/events/evxfgpe.c b/sys/contrib/dev/acpica/components/events/evxfgpe.c
index 8f24902..3a43733 100644
--- a/sys/contrib/dev/acpica/components/events/evxfgpe.c
+++ b/sys/contrib/dev/acpica/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);
}
OpenPOWER on IntegriCloud