aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2026-06-03 08:43:27 +0000
committerOlivier Certner <olce@FreeBSD.org>2026-06-17 03:06:11 +0000
commit6a2c4f0c0d9a9b93b26a1ad76f3a3fcbc590140c (patch)
treec89ab09c875f994168a5e3daeb52fede4b014b3d
parent556e793d803e12e9ad9361c6c53ed0433151f41e (diff)
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
-rw-r--r--sys/dev/acpica/acpi.c2
1 files changed, 1 insertions, 1 deletions
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),