]> Git Repo - linux.git/commitdiff
ARM: 8551/2: DMA: Fix kzalloc flags in __dma_alloc
authorAlexandre Courbot <[email protected]>
Wed, 13 Apr 2016 04:55:29 +0000 (05:55 +0100)
committerRussell King <[email protected]>
Fri, 15 Apr 2016 08:44:02 +0000 (09:44 +0100)
Commit 19e6e5e5392b ("ARM: 8547/1: dma-mapping: store buffer
information") allocates a structure meant for internal buffer management
with the GFP flags of the buffer itself. This can trigger the following
safeguard in the slab/slub allocator:

if (unlikely(flags & GFP_SLAB_BUG_MASK)) {
pr_emerg("gfp: %un", flags & GFP_SLAB_BUG_MASK);
BUG();
}

Fix this by filtering the flags that make the slab allocator unhappy.

Signed-off-by: Alexandre Courbot <[email protected]>
Acked-by: Rabin Vincent <[email protected]>
Signed-off-by: Russell King <[email protected]>
arch/arm/mm/dma-mapping.c

index deac58d5f1f7cf053ca215ec718c6902961a7908..c941e93048ad4d2ba09dabc2bb9451eaabcf8760 100644 (file)
@@ -762,7 +762,8 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
        if (!mask)
                return NULL;
 
-       buf = kzalloc(sizeof(*buf), gfp);
+       buf = kzalloc(sizeof(*buf),
+                     gfp & ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM));
        if (!buf)
                return NULL;
 
This page took 0.045063 seconds and 4 git commands to generate.