Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Sep 2021 11:47:14 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4e50efb1944b - main - Check cpu_softc is not NULL before dereferencing
Message-ID:  <202109271147.18RBlEPI093783@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=4e50efb1944bffe6ae648c8c81bd0814c18474b9

commit 4e50efb1944bffe6ae648c8c81bd0814c18474b9
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-09-27 11:22:15 +0000
Commit:     Andrew Turner <andrew@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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109271147.18RBlEPI093783>