diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2014-04-25 14:37:07 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2014-04-25 14:37:07 +0000 |
commit | eb70cdcec3a3053d817b802a9097d63d5603f19e (patch) | |
tree | 7b26cb0d0c9d3e273f9183578c719d78a5db4bd8 | |
parent | c6070be87e341a5d5e464f80238b95121582d8e9 (diff) |
Defer the free of the hibernate structures until later, when it is safe to
do so.
Freeing the hibernate structures too early leads to inadvertent calls into
splx when we aren't ready for them yet. Found when trapping splx calls in
the resume path.
discussed with deraadt@ at m2k14
-rw-r--r-- | sys/arch/amd64/amd64/acpi_machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/acpi_machdep.c | 9 | ||||
-rw-r--r-- | sys/dev/acpi/acpi.c | 10 |
3 files changed, 11 insertions, 17 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c index ec4be74cfa7..540469e52d5 100644 --- a/sys/arch/amd64/amd64/acpi_machdep.c +++ b/sys/arch/amd64/amd64/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.59 2014/03/27 10:24:40 dlg Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.60 2014/04/25 14:37:06 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -327,13 +327,6 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state) } /* Resume path */ -#ifdef HIBERNATE - if (state == ACPI_STATE_S4) { - hibernate_free(); - uvm_pmr_dirty_everything(); - } -#endif - /* Reset the vectors */ sc->sc_facs->wakeup_vector = 0; if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1) diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c index 2af0f10c6f3..fb803618f7e 100644 --- a/sys/arch/i386/i386/acpi_machdep.c +++ b/sys/arch/i386/i386/acpi_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_machdep.c,v 1.52 2014/03/13 03:52:55 dlg Exp $ */ +/* $OpenBSD: acpi_machdep.c,v 1.53 2014/04/25 14:37:06 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * @@ -350,13 +350,6 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state) } /* Resume path */ -#ifdef HIBERNATE - if (state == ACPI_STATE_S4) { - hibernate_free(); - uvm_pmr_dirty_everything(); - } -#endif - /* Reset the vectors */ sc->sc_facs->wakeup_vector = 0; if (sc->sc_facs->length > 32 && sc->sc_facs->version >= 1) diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c index 759344b4b52..a045de8178b 100644 --- a/sys/dev/acpi/acpi.c +++ b/sys/dev/acpi/acpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi.c,v 1.256 2014/04/13 14:43:01 mlarkin Exp $ */ +/* $OpenBSD: acpi.c,v 1.257 2014/04/25 14:37:06 mlarkin Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -2202,6 +2202,14 @@ fail_quiesce: acpi_record_event(sc, APM_NORMAL_RESUME); acpi_indicator(sc, ACPI_SST_WORKING); + +#ifdef HIBERNATE + if (state == ACPI_STATE_S4) { + hibernate_free(); + uvm_pmr_dirty_everything(); + } +#endif /* HIBERNATE */ + fail_tts: return (error); } |