git: 4e50efb1944b - main - Check cpu_softc is not NULL before dereferencing
Andrew Turner
andrew at FreeBSD.org
Mon Sep 27 11:47:14 UTC 2021
The branch main has been updated by andrew:
URL: https://cgit.FreeBSD.org/src/commit/?id=4e50efb1944bffe6ae648c8c81bd0814c18474b9
commit 4e50efb1944bffe6ae648c8c81bd0814c18474b9
Author: Andrew Turner <andrew at FreeBSD.org>
AuthorDate: 2021-09-27 11:22:15 +0000
Commit: Andrew Turner <andrew at FreeBSD.org>
CommitDate: 2021-09-27 11:32:12 +0000
Check cpu_softc is not NULL before dereferencing
In the acpi_cpu_postattach SYSINIT function cpu_softc may be NULL, e.g.
on arm64 when booting from FDT. Check it is not NULL at the start of
the function so we don't try to dereference a NULL pointer.
Sponsored by: The FreeBSD Foundation
---
sys/dev/acpica/acpi_cpu.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c
index 0577b6eac8b7..aac25af830ea 100644
--- a/sys/dev/acpica/acpi_cpu.c
+++ b/sys/dev/acpica/acpi_cpu.c
@@ -444,6 +444,9 @@ acpi_cpu_postattach(void *unused __unused)
struct acpi_cpu_softc *sc;
int attached = 0, i;
+ if (cpu_softc == NULL)
+ return;
+
mtx_lock(&Giant);
CPU_FOREACH(i) {
if ((sc = cpu_softc[i]) != NULL)
More information about the dev-commits-src-main
mailing list