git: bc98adaf6a93 - stable/13 - Check cpu_softc is not NULL before dereferencing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Jan 2022 18:09:23 UTC
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bc98adaf6a931de912917805d36bf2ed5777e258 commit bc98adaf6a931de912917805d36bf2ed5777e258 Author: Andrew Turner <andrew@FreeBSD.org> AuthorDate: 2021-09-27 11:22:15 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2022-01-04 18:08:58 +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 (cherry picked from commit 4e50efb1944bffe6ae648c8c81bd0814c18474b9) --- 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)