Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2024 00:34:46 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: c01a4b1fbc05 - stable/14 - iommu_get_requester(): do not panic if asked about non-pci device
Message-ID:  <202410200034.49K0YkeI061341@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib:

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

commit c01a4b1fbc05333b9faefb8d381b903e122a4cea
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-10-13 10:04:32 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-10-20 00:33:03 +0000

    iommu_get_requester(): do not panic if asked about non-pci device
    
    (cherry picked from commit 7896b03fff4d9c2e9c35ecf1dce2e0d672467a5a)
---
 sys/dev/iommu/busdma_iommu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/dev/iommu/busdma_iommu.c b/sys/dev/iommu/busdma_iommu.c
index f3b58306d6af..dbd4ee0ef0f1 100644
--- a/sys/dev/iommu/busdma_iommu.c
+++ b/sys/dev/iommu/busdma_iommu.c
@@ -127,6 +127,12 @@ iommu_get_requester(device_t dev, uint16_t *rid)
 	pci_class = devclass_find("pci");
 	l = requester = dev;
 
+	pci = device_get_parent(dev);
+	if (pci == NULL || device_get_devclass(pci) != pci_class) {
+		*rid = 0;	/* XXXKIB: Could be ACPI HID */
+		return (requester);
+	}
+
 	*rid = pci_get_rid(dev);
 
 	/*



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