From: Glauber Costa Date: Wed, 9 Apr 2008 16:18:09 +0000 (-0300) Subject: x86: don't do dma if mask is NULL. X-Git-Tag: v2.6.26-rc1~1133^2~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=bb8ada95a7c11adf3dad4e8d5c55ef1650560592;p=linux-2.6-omap-h63xx.git x86: don't do dma if mask is NULL. if the device hasn't provided a mask, abort allocation. Note that we're using a fallback device now, so it does not cover the case of a NULL device: just drivers passing NULL masks around. Signed-off-by: Glauber Costa Signed-off-by: Ingo Molnar Signed-off-by: Thomas Gleixner --- diff --git a/arch/x86/kernel/pci-dma_32.c b/arch/x86/kernel/pci-dma_32.c index f134de3833a..d2f70744a93 100644 --- a/arch/x86/kernel/pci-dma_32.c +++ b/arch/x86/kernel/pci-dma_32.c @@ -91,6 +91,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size, if (dma_mask == 0) dma_mask = DMA_32BIT_MASK; + if (dev->dma_mask == NULL) + return NULL; + /* Don't invoke OOM killer */ gfp |= __GFP_NORETRY; again: