git: 6a2c4f0c0d9a - main - acpi: Fix panic when reading 'hw.acpi.suspend_state' knob on S1/S2
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Jun 2026 03:08:21 UTC
The branch main has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=6a2c4f0c0d9a9b93b26a1ad76f3a3fcbc590140c
commit 6a2c4f0c0d9a9b93b26a1ad76f3a3fcbc590140c
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-06-03 08:43:27 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-06-17 03:06:11 +0000
acpi: Fix panic when reading 'hw.acpi.suspend_state' knob on S1/S2
The 'hw.acpi.suspend_state' sysctl knob was re-introduced with a bug.
Its handler, acpi_suspend_state_sysctl(), expects the ACPI softc in
'arg1', but the knob was registered with NULL there. This causes
a panic (NULL dereference) when reading the knob if the suspend state
has been set to S1 or S2 or equivalently the suspend sleep type to
STANDBY.
Fix it by passing the ACPI softc as 'arg1' when registering the knob.
Reviewed by: obiwac
Fixes: 9e1e29bd5ec6 ("acpi: Add back `hw.acpi.suspend_state` sysctl")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57412
---
sys/dev/acpica/acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index 5cb0afa581ca..107fb64459ce 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -748,7 +748,7 @@ acpi_attach(device_t dev)
"your laptop when you close the lid.");
SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),
OID_AUTO, "suspend_state", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
- NULL, 0, acpi_suspend_state_sysctl, "A",
+ sc, 0, acpi_suspend_state_sysctl, "A",
"Current ACPI suspend state. This sysctl is deprecated; you probably "
"want to use kern.power.suspend instead.");
SYSCTL_ADD_PROC(&sc->acpi_sysctl_ctx, SYSCTL_CHILDREN(sc->acpi_sysctl_tree),