Date: Wed, 27 Jun 2012 16:15:14 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r237652 - head/sys/contrib/dev/acpica/components/events Message-ID: <201206271615.q5RGFEIs019904@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Wed Jun 27 16:15:13 2012 New Revision: 237652 URL: http://svn.freebsd.org/changeset/base/237652 Log: 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) Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c Directory Properties: head/sys/contrib/dev/acpica/ (props changed) Modified: head/sys/contrib/dev/acpica/components/events/evxfgpe.c ============================================================================== --- head/sys/contrib/dev/acpica/components/events/evxfgpe.c Wed Jun 27 16:14:28 2012 (r237651) +++ head/sys/contrib/dev/acpica/components/events/evxfgpe.c Wed Jun 27 16:15:13 2012 (r237652) @@ -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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206271615.q5RGFEIs019904>