]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: virtio_uml: send SET_MEM_TABLE message with the exact size
authorBenjamin Berg <benjamin.berg@intel.com>
Sun, 3 Nov 2024 21:28:51 +0000 (22:28 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 7 Nov 2024 16:39:57 +0000 (17:39 +0100)
The rust based userspace vhost devices are very strict and will not
accept the message if it is longer than required. So, only include the
data for the first memory region.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Link: https://patch.msgid.link/20241103212854.1436046-2-benjamin@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/drivers/virtio_uml.c

index 4d3e9b9f5b6141d9c711f6581ab256fbdcf6546d..c602892f329f53c6df3c1461a4eec5772610e904 100644 (file)
@@ -623,7 +623,7 @@ static int vhost_user_set_mem_table(struct virtio_uml_device *vu_dev)
 {
        struct vhost_user_msg msg = {
                .header.request = VHOST_USER_SET_MEM_TABLE,
-               .header.size = sizeof(msg.payload.mem_regions),
+               .header.size = offsetof(typeof(msg.payload.mem_regions), regions[1]),
                .payload.mem_regions.num = 1,
        };
        unsigned long reserved = uml_reserved - uml_physmem;