From nobody Sat May 07 09:29:19 2022
X-Original-To: dev-commits-src-main@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 7C0E81ABBD21;
Sat, 7 May 2022 09:29:19 +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 4KwMZl36hZz4h3M;
Sat, 7 May 2022 09:29:19 +0000 (UTC)
(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1651915759;
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=9ySIe44Hx1OKeW4ofxtM79RErsalxrn9JxaMeyu5SWU=;
b=EOrQb3Q/HDnr8+4mxya2lQII4Io6QwxiO7mwyp0h1/KA9KRgUxtNrtcc/GmVMQ0MdJSl1y
BQRYJLDWqd/jHWbDUI7nh55gDe46ekNt58OMuuO+Hwp0pNV+rBc/bZHWi5iL2rzU/FkiZK
TX/OArnm2ubzFLI+io2kHdl6YeUhsAUG/WNYTzyc3vI6qxAqm5k0UUqHsmrTlrtQTb1JQd
rnMS8vWi0KrlWCocccLZn5WEhUX5wh4IL7b1MvIpPl1IRHUs2mo3vbmsFLSu3dkfr0/EL/
qVVHOFoucq82aX/ILmem9nNwTtR799C1eH7E7Cr9epXWWUgfxFAt7yWIjFzu7w==
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 46F515D37;
Sat, 7 May 2022 09:29:19 +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 2479TJfP089137;
Sat, 7 May 2022 09:29:19 GMT
(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2479TJ6n089136;
Sat, 7 May 2022 09:29:19 GMT
(envelope-from git)
Date: Sat, 7 May 2022 09:29:19 GMT
Message-Id: <202205070929.2479TJ6n089136@gitrepo.freebsd.org>
To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,
dev-commits-src-main@FreeBSD.org
From: Ruslan Bukin
Subject: git: 8b8e56dd5bc7 - main - Check if iommu ctx is valid before passing it to functions.
List-Id: Commit messages for the main branch of the src repository
List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main
List-Help:
List-Post:
List-Subscribe:
List-Unsubscribe:
Sender: owner-dev-commits-src-main@freebsd.org
X-BeenThere: dev-commits-src-main@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: br
X-Git-Repository: src
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 8b8e56dd5bc781b7d1c7185cd267b0b16a637aa2
Auto-Submitted: auto-generated
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
s=dkim; t=1651915759;
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=9ySIe44Hx1OKeW4ofxtM79RErsalxrn9JxaMeyu5SWU=;
b=HoebthZg5I/qGkrNQpc8vb2i3yLAV02gviDigFDADYdF/ZY5PHrBP0Z/BJFzarihTFyFDe
b5NDvTd2EevtkYCh1zTeJ96645eLGLEmwe1CB3SE7qyahwqDC7KwP6FqTmPH6iEAFNwlbo
OC2IY/gQfWpJay4n0qhiL61tvgihhWCYuI4tCawG/p4Tkvtuc10ceW28UmqgFFfQfFq7ot
9XE+0Xwr03BbnXGk62z6f2a0gZlSklDln5TnNmf71G3TeXnlf1rEeUpRR6+SsYDx1Ibj6U
fkrIWu+NX6H9rp4lhiydYClzaUqMMB9LzhqxvblplkL/fioG+d13h8zSGR+fpQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651915759; a=rsa-sha256; cv=none;
b=HuVbpuEx5J6tV8HzqJm94PTMZp2p55isvYdAP7lwcVX9Gl3Xn79DTDiGMz2LOZv/r7UGND
+HP8CSpeu03af65Bo5dgpF8Y5cSIU2lr+gM6dHQA6+BaJmkORxAs1Spk2CyEAh3/ah2dVH
DFA+AkiWo416C8sae9zNrMgeClLstPNxTKBlnDhDsDDQbtR9s+rCZ7FDO3Gqbuaw4Kfd8e
401Zz4ff16Mx8/w8Eoh2E+szNWmUZpvHnAZk2Elx4hPwcT+2Dpbrr+/oiwxDnlSNPCmZhi
JWZXil+owkuBPkuUuRx6HAOHjsoCZREBKjm1mllU571aK2+5zoyX5o/W8uvOtA==
ARC-Authentication-Results: i=1;
mx1.freebsd.org;
none
X-ThisMailContainsUnwantedMimeParts: N
The branch main has been updated by br:
URL: https://cgit.FreeBSD.org/src/commit/?id=8b8e56dd5bc781b7d1c7185cd267b0b16a637aa2
commit 8b8e56dd5bc781b7d1c7185cd267b0b16a637aa2
Author: Ruslan Bukin
AuthorDate: 2022-05-07 09:27:17 +0000
Commit: Ruslan Bukin
CommitDate: 2022-05-07 09:27:17 +0000
Check if iommu ctx is valid before passing it to functions.
Differential Revision: https://reviews.freebsd.org/D35130
Sponsored by: UKRI
---
sys/arm64/arm64/gicv3_its.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sys/arm64/arm64/gicv3_its.c b/sys/arm64/arm64/gicv3_its.c
index 7b06a44f35b3..a77be66bdd7f 100644
--- a/sys/arm64/arm64/gicv3_its.c
+++ b/sys/arm64/arm64/gicv3_its.c
@@ -1481,6 +1481,8 @@ gicv3_iommu_init(device_t dev, device_t child, struct iommu_domain **domain)
sc = device_get_softc(dev);
ctx = iommu_get_dev_ctx(child);
+ if (ctx == NULL)
+ return (ENXIO);
error = iommu_map_msi(ctx, PAGE_SIZE, GITS_TRANSLATER,
IOMMU_MAP_ENTRY_WRITE, IOMMU_MF_CANWAIT, &sc->ma);
*domain = iommu_get_ctx_domain(ctx);
@@ -1494,6 +1496,9 @@ gicv3_iommu_deinit(device_t dev, device_t child)
struct iommu_ctx *ctx;
ctx = iommu_get_dev_ctx(child);
+ if (ctx == NULL)
+ return;
+
iommu_unmap_msi(ctx);
}
#endif