git: c01a4b1fbc05 - stable/14 - iommu_get_requester(): do not panic if asked about non-pci device
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Oct 2024 00:34:46 UTC
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); /*