summaryrefslogtreecommitdiff
path: root/drivers/iommu/amd/iommu.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2026-05-25 06:33:15 -0700
committerAlexei Starovoitov <ast@kernel.org>2026-05-25 06:33:30 -0700
commiteb19eead368bb0f0ef06a4125d03ed661cd23d36 (patch)
treec831fe5940f705d97ee4ff8a33b14fe8ef013f31 /drivers/iommu/amd/iommu.c
parentb1fcdf9aa9f562d0768f59ae178ed4e67fd7f370 (diff)
parente7ae89a0c97ce2b68b0983cd01eda67cf373517d (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf 7.1-rc5
Cross-merge BPF and other fixes after downstream PR. Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'drivers/iommu/amd/iommu.c')
-rw-r--r--drivers/iommu/amd/iommu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c
index f78e23f03938..57dc8fabc7d9 100644
--- a/drivers/iommu/amd/iommu.c
+++ b/drivers/iommu/amd/iommu.c
@@ -351,8 +351,12 @@ static struct amd_iommu *__rlookup_amd_iommu(u16 seg, u16 devid)
struct amd_iommu_pci_seg *pci_seg;
for_each_pci_segment(pci_seg) {
- if (pci_seg->id == seg)
- return pci_seg->rlookup_table[devid];
+ if (pci_seg->id != seg)
+ continue;
+ /* IVRS may not describe every device on the bus */
+ if (devid > pci_seg->last_bdf)
+ return NULL;
+ return pci_seg->rlookup_table[devid];
}
return NULL;
}