Skip to content

Commit 05d3ed0

Browse files
praritIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent c010b2f commit 05d3ed0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/pci-gart_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static unsigned long alloc_iommu(struct device *dev, int size)
9393

9494
base_index = ALIGN(iommu_bus_base & dma_get_seg_boundary(dev),
9595
PAGE_SIZE) >> PAGE_SHIFT;
96-
boundary_size = ALIGN(dma_get_seg_boundary(dev) + 1,
96+
boundary_size = ALIGN((unsigned long long)dma_get_seg_boundary(dev) + 1,
9797
PAGE_SIZE) >> PAGE_SHIFT;
9898

9999
spin_lock_irqsave(&iommu_bitmap_lock, flags);

0 commit comments

Comments
 (0)