diff options
author | Alexandre Courbot <acourbot@nvidia.com> | 2016-04-13 00:55:29 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2016-04-15 04:44:02 -0400 |
commit | 9c18fcf7ae0ef87f0723dfd74c27d608c7486e0e (patch) | |
tree | 47e37ee905185e4b0021843cb7b1b2e483a035ce | |
parent | 208fae5c3b9431013ad7bcea07cbcee114e7d163 (diff) |
ARM: 8551/2: DMA: Fix kzalloc flags in __dma_alloc
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 <acourbot@nvidia.com>
Acked-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index deac58d5f1f7..c941e93048ad 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -762,7 +762,8 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, | |||
762 | if (!mask) | 762 | if (!mask) |
763 | return NULL; | 763 | return NULL; |
764 | 764 | ||
765 | buf = kzalloc(sizeof(*buf), gfp); | 765 | buf = kzalloc(sizeof(*buf), |
766 | gfp & ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM)); | ||
766 | if (!buf) | 767 | if (!buf) |
767 | return NULL; | 768 | return NULL; |
768 | 769 | ||