[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 7/7] vhost: fail backend intialization early
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 7/7] vhost: fail backend intialization early |
Date: |
Fri, 16 Oct 2015 11:49:43 +0300 |
From: Igor Mammedov <address@hidden>
Don't initialize vhost backend if memslots number exceeds the supported
limit. This prevents failures down the road when backend
is actually started.
[MST: rewrite commit log]
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/vhost.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index a3b4f9e..f14a5c5 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -933,6 +933,12 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
return -errno;
}
+ if (used_memslots > hdev->vhost_ops->vhost_backend_memslots_limit(hdev)) {
+ fprintf(stderr, "vhost backend memory slots limit is less"
+ " than current number of present memory slots\n");
+ close((uintptr_t)opaque);
+ return -1;
+ }
QLIST_INSERT_HEAD(&vhost_devices, hdev, entry);
r = hdev->vhost_ops->vhost_call(hdev, VHOST_SET_OWNER, NULL);
--
MST
- [Qemu-devel] [PULL 0/7] vhost, pc features, fixes, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 1/7] intel_iommu: Add support for translation for devices behind bridges, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 2/7] exec: factor out duplicate mmap code, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 3/7] net: don't set native endianness, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 5/7] vhost: add vhost_has_free_slot() interface, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 6/7] pc-dimm: add vhost slots limit check before commiting to hotplug, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 4/7] tests: re-enable vhost-user-test, Michael S. Tsirkin, 2015/10/16
- [Qemu-devel] [PULL 7/7] vhost: fail backend intialization early,
Michael S. Tsirkin <=
- Re: [Qemu-devel] [PULL 0/7] vhost, pc features, fixes, Peter Maydell, 2015/10/16