diff options
author | Alexandre Courbot | 2016-04-13 06:55:29 +0200 |
---|---|---|
committer | Russell King | 2016-04-15 10:44:02 +0200 |
commit | 9c18fcf7ae0ef87f0723dfd74c27d608c7486e0e (patch) | |
tree | 47e37ee905185e4b0021843cb7b1b2e483a035ce /arch/arm/mm/dma-mapping.c | |
parent | ARM: 8550/1: protect idiv patching against undefined gcc behavior (diff) | |
download | kernel-qcow2-linux-9c18fcf7ae0ef87f0723dfd74c27d608c7486e0e.tar.gz kernel-qcow2-linux-9c18fcf7ae0ef87f0723dfd74c27d608c7486e0e.tar.xz kernel-qcow2-linux-9c18fcf7ae0ef87f0723dfd74c27d608c7486e0e.zip |
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>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-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, if (!mask) return NULL; - buf = kzalloc(sizeof(*buf), gfp); + buf = kzalloc(sizeof(*buf), + gfp & ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM)); if (!buf) return NULL; |