summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-06-26 10:01:40 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2022-06-26 10:01:40 -0700
commitc898c67db6d7de1b1e7970cd16c45eaa46bd231b (patch)
treec73dd73adff7e150c52b394240cce45626ed6e4d
parentbe129fab66f284c239251ec5b6e30c6e903d8881 (diff)
parent3be4562584bba603f33863a00c1c32eecf772ee6 (diff)
downloadlinux-stable-c898c67db6d7de1b1e7970cd16c45eaa46bd231b.tar.gz
linux-stable-c898c67db6d7de1b1e7970cd16c45eaa46bd231b.tar.bz2
linux-stable-c898c67db6d7de1b1e7970cd16c45eaa46bd231b.zip
Merge tag 'dma-mapping-5.19-2022-06-26' of git://git.infradead.org/users/hch/dma-mapping
Pull dma-mapping fix from Christoph Hellwig: - pass the correct size to dma_set_encrypted() when freeing memory (Dexuan Cui) * tag 'dma-mapping-5.19-2022-06-26' of git://git.infradead.org/users/hch/dma-mapping: dma-direct: use the correct size for dma_set_encrypted()
-rw-r--r--kernel/dma/direct.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c
index e978f36e6be8..8d0b68a17042 100644
--- a/kernel/dma/direct.c
+++ b/kernel/dma/direct.c
@@ -357,7 +357,7 @@ void dma_direct_free(struct device *dev, size_t size,
} else {
if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_CLEAR_UNCACHED))
arch_dma_clear_uncached(cpu_addr, size);
- if (dma_set_encrypted(dev, cpu_addr, 1 << page_order))
+ if (dma_set_encrypted(dev, cpu_addr, size))
return;
}
@@ -392,7 +392,6 @@ void dma_direct_free_pages(struct device *dev, size_t size,
struct page *page, dma_addr_t dma_addr,
enum dma_data_direction dir)
{
- unsigned int page_order = get_order(size);
void *vaddr = page_address(page);
/* If cpu_addr is not from an atomic pool, dma_free_from_pool() fails */
@@ -400,7 +399,7 @@ void dma_direct_free_pages(struct device *dev, size_t size,
dma_free_from_pool(dev, vaddr, size))
return;
- if (dma_set_encrypted(dev, vaddr, 1 << page_order))
+ if (dma_set_encrypted(dev, vaddr, size))
return;
__dma_direct_free_pages(dev, page, size);
}