]> Git Repo - J-linux.git/commitdiff
dma-mapping: reject GFP_COMP for noncoherent allocations
authorChristoph Hellwig <[email protected]>
Tue, 20 Dec 2022 08:08:12 +0000 (09:08 +0100)
committerChristoph Hellwig <[email protected]>
Wed, 21 Dec 2022 07:45:38 +0000 (08:45 +0100)
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 ffcb75458460 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: ffcb75458460 ("dma-mapping: reject __GFP_COMP in dma_alloc_attrs")
Reported-by: Mikhail Gavrilov <[email protected]>
Reported-by: Kai Vehmanen <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Acked-by: Takashi Iwai <[email protected]>
Tested-by: Mikhail Gavrilov <[email protected]>
Tested-by: Kai Vehmanen <[email protected]>
kernel/dma/mapping.c

index c026a5a5e0466e188b72bf6db620120e4daff2b3..68106e3791f6c3e5da1725e719caf5337a4e72d7 100644 (file)
@@ -560,6 +560,8 @@ static struct page *__dma_alloc_pages(struct device *dev, size_t size,
                return NULL;
        if (WARN_ON_ONCE(gfp & (__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM)))
                return NULL;
+       if (WARN_ON_ONCE(gfp & __GFP_COMP))
+               return NULL;
 
        size = PAGE_ALIGN(size);
        if (dma_alloc_direct(dev, ops))
@@ -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))
                return NULL;
+       if (WARN_ON_ONCE(gfp & __GFP_COMP))
+               return NULL;
 
        if (ops && ops->alloc_noncontiguous)
                sgt = ops->alloc_noncontiguous(dev, size, dir, gfp, attrs);
This page took 0.055685 seconds and 4 git commands to generate.