Skip to content
Commit 56fccf21 authored by David Rientjes's avatar David Rientjes Committed by Christoph Hellwig
Browse files

dma-direct: check return value when encrypting or decrypting memory



__change_page_attr() can fail which will cause set_memory_encrypted() and
set_memory_decrypted() to return non-zero.

If the device requires unencrypted DMA memory and decryption fails, simply
free the memory and fail.

If attempting to re-encrypt in the failure path and that encryption fails,
there is no alternative other than to leak the memory.

Fixes: c10f07aa ("dma/direct: Handle force decryption for DMA coherent buffers in common code")
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 96a539fa
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment