Skip to contentSkip to conversation

vhost_dev:qemu will quit when vhost_dev is null

PATCH In review [email protected] 2 participants 2 messages Jun 1, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost_dev:qemu will quit when vhost_dev is null

From: "yin.zuowei" <[email protected]>

when ovdk socket is not ok, this vhost_dev is null ,then qemu will be quit. We think ovdk is just a network devices, should not cause an exit .

---
 hw/virtio/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
hw/virtio/vhost-user.c +3 -0
index dde094a..3a9fdf4 100644
@@ -387,6 +387,9 @@ static int vhost_user_set_vring_base(struct vhost_dev *dev,
 static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
 {
     int i;
+    if (!dev) {
+        return -1;
+    }
 
     if (!virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES)) {
         return -1;
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 6 lines · On Thu, Jun 01, 2017 at 10:51:27AM -0400, [email protected] wrote:

From: "yin.zuowei" <[email protected]>

when ovdk socket is not ok, this vhost_dev is null ,then qemu will be quit. We think ovdk is just a network devices, should not cause an exit .

It is called like this:

    if (vhost_ops && vhost_ops->vhost_set_vring_enable) {
        return vhost_ops->vhost_set_vring_enable(&net->dev, enable);
    }

so how can it be NULL?

Quoted 21 lines
---
 hw/virtio/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
hw/virtio/vhost-user.c +3 -0
index dde094a..3a9fdf4 100644
@@ -387,6 +387,9 @@ static int vhost_user_set_vring_base(struct vhost_dev *dev,
 static int vhost_user_set_vring_enable(struct vhost_dev *dev, int enable)
 {
     int i;
+    if (!dev) {
+        return -1;
+    }
 
     if (!virtio_has_feature(dev->features, VHOST_USER_F_PROTOCOL_FEATURES)) {
         return -1;
Signature · 1 line
1.8.3.1