Commit 3622b86f authored by Christoph Hellwig's avatar Christoph Hellwig

dma-mapping: reject GFP_COMP for noncoherent allocations

While not quite as bogus as for the dma-coherent allocations that were
fixed earlier, GFP_COMP for these allocations has no benefits for
the dma-direct case, and can't be supported at all by dma dma-iommu
backend which splits up allocations into smaller orders.  Due to an
oversight in ffcb7545 that flag stopped being cleared for all
dma allocations, but only got rejected for coherent ones, so fix up
these callers to not allow __GFP_COMP as well after the sound code
has been fixed to not ask for it.

Fixes: ffcb7545 ("dma-mapping: reject __GFP_COMP in dma_alloc_attrs")
Reported-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Reported-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarTakashi Iwai <tiwai@suse.de>
Tested-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Tested-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
parent db918321
...@@ -560,6 +560,8 @@ static struct page *__dma_alloc_pages(struct device *dev, size_t size, ...@@ -560,6 +560,8 @@ static struct page *__dma_alloc_pages(struct device *dev, size_t size,
return NULL; return NULL;
if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM))) if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM)))
return NULL; return NULL;
if (WARN_ON_ONCE(gfp & __GFP_COMP))
return NULL;
size = PAGE_ALIGN(size); size = PAGE_ALIGN(size);
if (dma_alloc_direct(dev, ops)) if (dma_alloc_direct(dev, ops))
...@@ -645,6 +647,8 @@ struct sg_table *dma_alloc_noncontiguous(struct device *dev, size_t size, ...@@ -645,6 +647,8 @@ struct sg_table *dma_alloc_noncontiguous(struct device *dev, size_t size,
if (WARN_ON_ONCE(attrs & ~DMA_ATTR_ALLOC_SINGLE_PAGES)) if (WARN_ON_ONCE(attrs & ~DMA_ATTR_ALLOC_SINGLE_PAGES))
return NULL; return NULL;
if (WARN_ON_ONCE(gfp & __GFP_COMP))
return NULL;
if (ops && ops->alloc_noncontiguous) if (ops && ops->alloc_noncontiguous)
sgt = ops->alloc_noncontiguous(dev, size, dir, gfp, attrs); sgt = ops->alloc_noncontiguous(dev, size, dir, gfp, attrs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment