qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 2/3] vhost-user: Fix VHOST_SET_MEM_TABLE processing


From: Nikolay Nikolaev
Subject: [Qemu-devel] [PATCH 2/3] vhost-user: Fix VHOST_SET_MEM_TABLE processing
Date: Tue, 08 Jul 2014 17:06:08 +0300
User-agent: StGit/0.17.1-dirty

For each memory region we use qemu_get_ram_fd to get the RAMBlock
associated file descriptor. It uses qemu_get_ram_block to find the proper 
structure.
The latter aborts with "Bad ram offset" when the address is not found.

We'll use the new qemu_is_ram_block to indentify non-RAM regions and avoid 
qemu_get_ram_fd
call on them.

Signed-off-by: Nikolay Nikolaev <address@hidden>
---
 hw/virtio/vhost-user.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 38e5806..876b080 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -216,6 +216,10 @@ static int vhost_user_call(struct vhost_dev *dev, unsigned 
long int request,
     case VHOST_SET_MEM_TABLE:
         for (i = 0; i < dev->mem->nregions; ++i) {
             struct vhost_memory_region *reg = dev->mem->regions + i;
+            if (!qemu_is_ram_block(reg->guest_phys_addr)) {
+                /* this is non-RAM region - skip it */
+                continue;
+            }
             fd = qemu_get_ram_fd(reg->guest_phys_addr);
             if (fd > 0) {
                 msg.memory.regions[fd_num].userspace_addr = 
reg->userspace_addr;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]