[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] vhost: fix miration during device start
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PATCH] vhost: fix miration during device start |
Date: |
Fri, 16 Jul 2010 17:11:46 +0300 |
User-agent: |
Mutt/1.5.20 (2009-12-10) |
We need to know ring layout to allocate log buffer.
So init rings first.
Also fixes a theoretical memory-leak-on-error.
https://bugzilla.redhat.com/show_bug.cgi?id=615228
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
diff --git a/hw/vhost.c b/hw/vhost.c
index d37a66e..25cb9f5 100644
--- a/hw/vhost.c
+++ b/hw/vhost.c
@@ -659,6 +659,16 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice
*vdev)
r = -errno;
goto fail;
}
+ for (i = 0; i < hdev->nvqs; ++i) {
+ r = vhost_virtqueue_init(hdev,
+ vdev,
+ hdev->vqs + i,
+ i);
+ if (r < 0) {
+ goto fail_vq;
+ }
+ }
+
if (hdev->log_enabled) {
hdev->log_size = vhost_get_log_size(hdev);
hdev->log = hdev->log_size ?
@@ -671,15 +681,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice
*vdev)
}
}
- for (i = 0; i < hdev->nvqs; ++i) {
- r = vhost_virtqueue_init(hdev,
- vdev,
- hdev->vqs + i,
- i);
- if (r < 0) {
- goto fail_vq;
- }
- }
hdev->started = true;
return 0;
- [Qemu-devel] [PATCH] vhost: fix miration during device start,
Michael S. Tsirkin <=