浏览代码

[PATCH] x86_64: Check for too many northbridges in IOMMU code

The IOMMU code can only deal with 8 northbridges. Error out when
more are found.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andi Kleen 19 年之前
父节点
当前提交
5192d84e4c
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      arch/x86_64/kernel/pci-gart.c

+ 8 - 0
arch/x86_64/kernel/pci-gart.c

@@ -639,6 +639,14 @@ static int __init pci_iommu_init(void)
 		return -1;
 		return -1;
 	}
 	}
 
 
+	i = 0;
+	for_all_nb(dev)
+		i++;
+	if (i > MAX_NB) {
+		printk(KERN_ERR "PCI-GART: Too many northbridges (%ld). Disabled\n", i);
+		return -1;
+	}
+
 	printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
 	printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
 	aper_size = info.aper_size * 1024 * 1024;	
 	aper_size = info.aper_size * 1024 * 1024;	
 	iommu_size = check_iommu_size(info.aper_base, aper_size); 
 	iommu_size = check_iommu_size(info.aper_base, aper_size);