]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
uio_hv_generic: Don't free decrypted memory
authorRick Edgecombe <rick.p.edgecombe@intel.com>
Mon, 11 Mar 2024 16:15:57 +0000 (09:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:02:17 +0000 (12:02 +0200)
commit6466a0f6d235c8a18c602cb587160d7e49876db9
tree3dd4e485be218be41b43e5898ebae8cff911bc89
parenta56fe611326332bf6b7126e5559590c57dcebad4
uio_hv_generic: Don't free decrypted memory

[ Upstream commit 3d788b2fbe6a1a1a9e3db09742b90809d51638b7 ]

In CoCo VMs 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.

The VMBus device UIO driver could free decrypted/shared pages if
set_memory_decrypted() fails. Check the decrypted field in the gpadl
to decide whether to free the memory.

Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Link: https://lore.kernel.org/r/20240311161558.1310-5-mhklinux@outlook.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20240311161558.1310-5-mhklinux@outlook.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/uio/uio_hv_generic.c