summaryrefslogtreecommitdiff
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2017-11-29 15:12:27 +0100
committerBjorn Helgaas <bhelgaas@google.com>2017-12-06 14:57:19 -0600
commit470195f82e4ea550b7c37736a12bf3fa565295ea (patch)
treeaaf23e0724734e83283c075114125c62df4838bb /arch/x86/pci
parent7912af5c835bd86f2b0347a480e0f40e2fab30d0 (diff)
x86/PCI: Fix infinite loop in search for 64bit BAR placement
Break the loop if we can't find some address space for a 64bit BAR. Signed-off-by: Christian König <christian.koenig@amd.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r--arch/x86/pci/fixup.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c
index 1e996df687a3..5328e86f73eb 100644
--- a/arch/x86/pci/fixup.c
+++ b/arch/x86/pci/fixup.c
@@ -696,8 +696,13 @@ static void pci_amd_enable_64bit_bar(struct pci_dev *dev)
res->end = 0xfd00000000ull - 1;
/* Just grab the free area behind system memory for this */
- while ((conflict = request_resource_conflict(&iomem_resource, res)))
+ while ((conflict = request_resource_conflict(&iomem_resource, res))) {
+ if (conflict->end >= res->end) {
+ kfree(res);
+ return;
+ }
res->start = conflict->end + 1;
+ }
dev_info(&dev->dev, "adding root bus resource %pR\n", res);