peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame qemu-virtio-avoid-crash-with-non-tap-backends.patch

Justin M. Forbes 272dfe
verify that peer is tap before checking for vhost net
Justin M. Forbes 272dfe
Justin M. Forbes 272dfe
Reported-by: Shirley Ma <mashirle@us.ibm.com>
Justin M. Forbes 272dfe
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Justin M. Forbes 272dfe
---
Justin M. Forbes 272dfe
 hw/virtio-net.c |    4 ++++
Justin M. Forbes 272dfe
 1 files changed, 4 insertions(+), 0 deletions(-)
Justin M. Forbes 272dfe
Justin M. Forbes 272dfe
diff --git a/hw/virtio-net.c b/hw/virtio-net.c
Justin M. Forbes 272dfe
index 088029b..b28fd92 100644
Justin M. Forbes 272dfe
--- a/hw/virtio-net.c
Justin M. Forbes 272dfe
+++ b/hw/virtio-net.c
Justin M. Forbes 272dfe
@@ -179,6 +179,10 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
Justin M. Forbes 272dfe
         features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
Justin M. Forbes 272dfe
     }
Justin M. Forbes 272dfe
 
Justin M. Forbes 272dfe
+    if (!n->nic->nc.peer ||
Justin M. Forbes 272dfe
+	n->nic->nc.peer->info->type != NET_CLIENT_TYPE_TAP) {
Justin M. Forbes 272dfe
+        return features;
Justin M. Forbes 272dfe
+    }
Justin M. Forbes 272dfe
     if (!tap_get_vhost_net(n->nic->nc.peer)) {
Justin M. Forbes 272dfe
         return features;
Justin M. Forbes 272dfe
     }
Justin M. Forbes 272dfe
-- 
Justin M. Forbes 272dfe
1.6.6.144.g5c3af