]> www.infradead.org Git - users/hch/dma-mapping.git/commit
dma-direct: Leak pages on dma_set_decrypted() failure dma-mapping-6.9-2024-03-11
authorRick Edgecombe <rick.p.edgecombe@intel.com>
Thu, 22 Feb 2024 00:17:21 +0000 (16:17 -0800)
committerChristoph Hellwig <hch@lst.de>
Wed, 28 Feb 2024 13:31:38 +0000 (05:31 -0800)
commitb9fa16949d18e06bdf728a560f5c8af56d2bdcaf
treee782bb7a077155204de573f586d9cfd97f44b5d2
parent02e765697038c596dc4a1126a13b018608365d81
dma-direct: Leak pages on dma_set_decrypted() failure

On TDX it is possible for the untrusted host to cause
set_memory_encrypted() or set_memory_decrypted() to fail such that an
error is returned and the resulting memory is shared. Callers need to
take care to handle these errors to avoid returning decrypted (shared)
memory to the page allocator, which could lead to functional or security
issues.

DMA could free decrypted/shared pages if dma_set_decrypted() fails. This
should be a rare case. Just leak the pages in this case instead of
freeing them.

Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
kernel/dma/direct.c