[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intialization if
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH for-2.4 v3 3/3] vhost: fail backend intialization if memslots number is more than its supported limit |
Date: |
Thu, 30 Jul 2015 12:11:59 +0200 |
Signed-off-by: Igor Mammedov <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 bcbad48..48fbac1 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -985,6 +985,12 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque,
hdev->started = false;
hdev->memory_changed = false;
memory_listener_register(&hdev->memory_listener, &address_space_memory);
+ if (!vhost_has_free_slot()) {
+ fprintf(stderr, "vhost backend memory slots limit is less"
+ " than current number of present memory slots\n");
+ vhost_dev_cleanup(hdev);
+ return -1;
+ }
return 0;
fail_vq:
while (--i >= 0) {
--
1.8.3.1