Re: DMA direct mapping fix for 5.4 and earlier stable branches

From: Christoph Hellwig
Date: Tue Feb 09 2021 - 10:51:47 EST


On Tue, Feb 09, 2021 at 12:45:11PM +0000, Robin Murphy wrote:
> It's not a bug, it's a fundamental design failure. dma_get_sgtable() has
> only ever sort-of-worked for DMA buffers that come from CMA or regular page
> allocations. In particular, a "no-map" DMA pool is not backed by kernel
> memory, so does not have any corresponding page structs, so it's impossible
> to generate a *valid* scatterlist to represent memory from that pool,
> regardless of what you might get away with provided you don't poke too hard
> at it.
>
> It is not a good API...

Yes, I don't think anyone should add new users of the API.

That being said the commit he is trying to backport fixes a bug in
the implementation that at least in theory could also affect in-tree
drivers.