Patch "Drivers: hv: vmbus: Don't free ring buffers that couldn't be re-encrypted" has been added to the 6.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    Drivers: hv: vmbus: Don't free ring buffers that couldn't be re-encrypted

to the 6.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drivers-hv-vmbus-don-t-free-ring-buffers-that-couldn.patch
and it can be found in the queue-6.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c847f1aaed5d168f9c71b50868fb04e85e074526
Author: Michael Kelley <mhklinux@xxxxxxxxxxx>
Date:   Mon Mar 11 09:15:58 2024 -0700

    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@xxxxxxxxxxx>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240311161558.1310-6-mhklinux@xxxxxxxxxxx
    Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
    Message-ID: <20240311161558.1310-6-mhklinux@xxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 98259b4925029..fb8cd8469328e 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -153,7 +153,9 @@ void vmbus_free_ring(struct vmbus_channel *channel)
 	hv_ringbuffer_cleanup(&channel->inbound);
 
 	if (channel->ringbuffer_page) {
-		__free_pages(channel->ringbuffer_page,
+		/* In a CoCo VM leak the memory if it didn't get re-encrypted */
+		if (!channel->ringbuffer_gpadlhandle.decrypted)
+			__free_pages(channel->ringbuffer_page,
 			     get_order(channel->ringbuffer_pagecount
 				       << PAGE_SHIFT));
 		channel->ringbuffer_page = NULL;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux