]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86, pci: iommu fix potential overflow in alloc_iommu()
authorPrarit Bhargava <prarit@redhat.com>
Mon, 21 Jul 2008 14:15:22 +0000 (10:15 -0400)
committerIngo Molnar <mingo@elte.hu>
Wed, 23 Jul 2008 14:45:15 +0000 (16:45 +0200)
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>
arch/x86/kernel/pci-gart_64.c

index df5f142657d27352a9e3c1bbd911fd89f677c1fa..1062dc1e6396395e3d70a21cb99617fd61087b16 100644 (file)
@@ -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);