git: 2bcf5741a9d1 - main - acpi: set up the sysctl tree before acpi_machdep_init()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Nov 2026 05:53:25 UTC
The branch main has been updated by nprice:
URL: https://cgit.FreeBSD.org/src/commit/?id=2bcf5741a9d16dbe8ac3fa00e33001ca30ac5d93
commit 2bcf5741a9d16dbe8ac3fa00e33001ca30ac5d93
Author: Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-11-24 05:52:34 +0000
Commit: Nick Price <nprice@FreeBSD.org>
CommitDate: 2026-11-24 05:53:07 +0000
acpi: set up the sysctl tree before acpi_machdep_init()
On amd64 and i386, acpi_machdep_init() adds hw.acpi.reset_video under
acpi_sysctl_tree. Since the tree moved to the end of attach, it no
longer exists at that point, so sysctl_add_oid() drops the node and the
sysctl documented in acpi(4) is missing. Found with KUBSAN.
acpi_machdep_init() cannot fail, so calling it after the tree does not
leave knobs behind on a failed attach.
Fixes: 7f031c9f6b9f ("acpi: Move sysctl tree set up at end of initialization")
Signed-off-by: Nick Price <nprice@FreeBSD.org>
Reviewed by: olce
Differential Revision: https://reviews.freebsd.org/D60797
---
sys/dev/acpica/acpi.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index f63373ee06f9..1ce3781913a9 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -742,9 +742,6 @@ acpi_attach(device_t dev)
"acpi");
sc->acpi_dev_t->si_drv1 = sc;
- if ((error = acpi_machdep_init(dev)))
- goto out;
-
/*
* Setup our sysctl tree.
*
@@ -813,6 +810,11 @@ acpi_attach(device_t dev)
"Force active-hi polarity for edge-triggered ISA IRQs");
#endif
+ if ((error = acpi_machdep_init(dev))) {
+ sysctl_ctx_free(&sc->acpi_sysctl_ctx);
+ goto out;
+ }
+
/* Register ACPI again to pass the correct argument of pm_func. */
power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc,
sc->acpi_supported_stypes);