瀏覽代碼

x86, pci: iommu fix potential overflow in alloc_iommu()

It is possible that alloc_iommu()'s boundary_size overflows as
dma_get_seg_boundary can return 0xffffffff.  In that case, further usage of
boundary_size triggers a BUG_ON() in the iommu code.

Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Prarit Bhargava 17 年之前
父節點
當前提交
05d3ed0a1f
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/x86/kernel/pci-gart_64.c

+ 1 - 1
arch/x86/kernel/pci-gart_64.c

@@ -93,7 +93,7 @@ static unsigned long alloc_iommu(struct device *dev, int size)
 
 	base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev),
 			   PAGE_SIZE) >> PAGE_SHIFT;
-	boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
+	boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
 			      PAGE_SIZE) >> PAGE_SHIFT;
 
 	spin_lock_irqsave(&iommu_bitmap_lock, flags);