render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone
Blob Blame History Raw
verify that peer is tap before checking for vhost net

Reported-by: Shirley Ma <mashirle@us.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/virtio-net.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/virtio-net.c b/hw/virtio-net.c
index 088029b..b28fd92 100644
--- a/hw/virtio-net.c
+++ b/hw/virtio-net.c
@@ -179,6 +179,10 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
         features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
     }
 
+    if (!n->nic->nc.peer ||
+	n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
+        return features;
+    }
     if (!tap_get_vhost_net(n->nic->nc.peer)) {
         return features;
     }
-- 
1.6.6.144.g5c3af