]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Drivers: hv: vmbus: Don't free ring buffers that couldn't be re-encrypted
authorMichael Kelley <mhklinux@outlook.com>
Mon, 11 Mar 2024 16:15:58 +0000 (09:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 May 2024 10:14:47 +0000 (12:14 +0200)
commita9212a4e2963a7fbe3864ba33dc551d4ad8d0abb
tree71e0aa0307c2cc32d330e6186a1a949fa5b71a52
parentfe2c58602354fbd60680dc42ac3a0b772cda7d23
Drivers: hv: vmbus: Don't free ring buffers that couldn't be re-encrypted

[ Upstream commit 30d18df6567be09c1433e81993e35e3da573ac48 ]

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 ring buffer code could free decrypted/shared pages if
set_memory_decrypted() fails. Check the decrypted field in the struct
vmbus_gpadl for the ring buffers to decide whether to free the memory.

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-6-mhklinux@outlook.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20240311161558.1310-6-mhklinux@outlook.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hv/channel.c