dma-coherent: catch oversized requests to dma_alloc_from_coherent()
[linux-2.6.git] / kernel / dma-coherent.c
index 8056d081609caacd13b26e3dceedd6b07cd5550e..038707404b76075866d6bccb5df015d9965762c4 100644 (file)
@@ -118,6 +118,8 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size,
        mem = dev->dma_mem;
        if (!mem)
                return 0;
+       if (unlikely(size > mem->size))
+               return 0;
 
        pageno = bitmap_find_free_region(mem->bitmap, mem->size, order);
        if (pageno >= 0) {