From nobody Tue Jan 04 18:09:23 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 166FD19269AD; Tue, 4 Jan 2022 18:09:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JT0xb5bXNz3Cw6; Tue, 4 Jan 2022 18:09:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C6911D90C; Tue, 4 Jan 2022 18:09:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 204I9NYK026226; Tue, 4 Jan 2022 18:09:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 204I9Njf026225; Tue, 4 Jan 2022 18:09:23 GMT (envelope-from git) Date: Tue, 4 Jan 2022 18:09:23 GMT Message-Id: <202201041809.204I9Njf026225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: bc98adaf6a93 - stable/13 - Check cpu_softc is not NULL before dereferencing List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc98adaf6a931de912917805d36bf2ed5777e258 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1641319763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=KDqMTmUUXOVdlAGiOZxMgJyLg392/7fsQrJ3ltQOeMM=; b=ZjOh0lNgF+xjE71p/LYdxcoPCycli/GrtKmYbeisKhl/yPxbxYCTNwYUrt8kNRG/SJLm/0 jM3+vR3fNB7jkf+yz0pSWpmSoYSKjGdH2o7dcMlQ51mM7YiWMzs6mCZoSeskAir+HUTK7O idD+p30vTtHCXzvhwt093SrOcrcCNvje27lCHlbDzYu1yMpj3+c5qeT260okHv2s65M39Q ev/kUmgrkvBzS4ZYemB8fYpFPuvBlTTN5tbfEM1fN2exU7LgVaFjIryeE5DkswnFGqKVKc UDAbNXBsDpYtfKdB2uaXRzxfEWDp8Y4yIaTn/bFPnEh/U6c/288U1GdAeqacNQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1641319763; a=rsa-sha256; cv=none; b=BziLi0v07IlNN9uyOd3Uix5tQMU/CJsyxoCUcwXN52IB4B+oe9LoTOmW0IvcBUy/6F0655 NEsoQd/z2Ne129SoY/qRCfvxiRiYojMz2CnvFvyuy/sWXTve3yjCct5CGkbfettciKjCsP AX+Ly7xNwLmSh5mebZh5sMmPsIyGDJB/1RE1ikUciPTcpG7s6O0Q7jjBOTXZJd36DlAv/J 11essX3pRqbjQbyLx4euYRy/CxYyBotxabrdVh95gUJPBnGeHkZCHHkvAfK3AVV0xRS0fs vh1vqu8gMU68Z5t0kWF0PeUhcaMbYj7xAvUhCV2v7RmHfCexeqmsLs4UHfUGkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=bc98adaf6a931de912917805d36bf2ed5777e258 commit bc98adaf6a931de912917805d36bf2ed5777e258 Author: Andrew Turner AuthorDate: 2021-09-27 11:22:15 +0000 Commit: Alexander Motin 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)