Skip to content

Commit 7623279

Browse files
shankerd04gregkh
authored andcommitted
dma/pool: Ensure DMA_DIRECT_REMAP allocations are decrypted
commit 89a2d21 upstream. When CONFIG_DMA_DIRECT_REMAP is enabled, atomic pool pages are remapped via dma_common_contiguous_remap() using the supplied pgprot. Currently, the mapping uses pgprot_dmacoherent(PAGE_KERNEL), which leaves the memory encrypted on systems with memory encryption enabled (e.g., ARM CCA Realms). This can cause the DMA layer to fail or crash when accessing the memory, as the underlying physical pages are not configured as expected. Fix this by requesting a decrypted mapping in the vmap() call: pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)) This ensures that atomic pool memory is consistently mapped unencrypted. Cc: stable@vger.kernel.org Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Link: https://lore.kernel.org/r/20250811181759.998805-1-sdonthineni@nvidia.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 681a781 commit 7623279

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

kernel/dma/pool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ static int atomic_pool_expand(struct gen_pool *pool, size_t pool_size,
102102

103103
#ifdef CONFIG_DMA_DIRECT_REMAP
104104
addr = dma_common_contiguous_remap(page, pool_size,
105-
pgprot_dmacoherent(PAGE_KERNEL),
106-
__builtin_return_address(0));
105+
pgprot_decrypted(pgprot_dmacoherent(PAGE_KERNEL)),
106+
__builtin_return_address(0));
107107
if (!addr)
108108
goto free_page;
109109
#else

0 commit comments

Comments
 (0)