Skip to content

Commit 3da4af0

Browse files
Alex Williamsonjoergroedel
authored andcommitted
intel-iommu: Fix lookup in add device
We can't assume this device exists, fall back to the bridge itself. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Tested-by: Matthew Thode <prometheanfire@gentoo.org> Cc: stable@vger.kernel.org Signed-off-by: Joerg Roedel <joro@8bytes.org>
1 parent b334b64 commit 3da4af0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎drivers/iommu/intel-iommu.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4108,7 +4108,7 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
41084108
static int intel_iommu_add_device(struct device *dev)
41094109
{
41104110
struct pci_dev *pdev = to_pci_dev(dev);
4111-
struct pci_dev *bridge, *dma_pdev;
4111+
struct pci_dev *bridge, *dma_pdev = NULL;
41124112
struct iommu_group *group;
41134113
int ret;
41144114

@@ -4122,7 +4122,7 @@ static int intel_iommu_add_device(struct device *dev)
41224122
dma_pdev = pci_get_domain_bus_and_slot(
41234123
pci_domain_nr(pdev->bus),
41244124
bridge->subordinate->number, 0);
4125-
else
4125+
if (!dma_pdev)
41264126
dma_pdev = pci_dev_get(bridge);
41274127
} else
41284128
dma_pdev = pci_dev_get(pdev);

0 commit comments

Comments
 (0)