be904d
From 92fb4f6cdde32652352a0a831a2ba815701a4014 Mon Sep 17 00:00:00 2001
be904d
From: Juan Quintela <quintela@redhat.com>
be904d
Date: Fri, 3 Jul 2020 12:37:05 -0400
be904d
Subject: [PATCH 4/4] virtio-net: fix removal of failover device
be904d
be904d
RH-Author: Juan Quintela <quintela@redhat.com>
be904d
Message-id: <20200703123705.7175-2-quintela@redhat.com>
be904d
Patchwork-id: 97901
be904d
O-Subject: [RHEL-AV-8.2.1 qemu-kvm PATCH 1/1] virtio-net: fix removal of failover device
be904d
Bugzilla:
be904d
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
be904d
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
be904d
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
be904d
be904d
If you have a networking device and its virtio failover device, and
be904d
you remove them in this order:
be904d
- virtio device
be904d
- the real device
be904d
be904d
You get qemu crash.
be904d
See bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820120
be904d
be904d
Bug exist on qemu 4.2 and 5.0.
be904d
But in 5.0 don't shows because commit
be904d
77b06bba62034a87cc61a9c8de1309ae3e527d97
be904d
be904d
somehow papers over it.
be904d
be904d
CC: Jason Wang <jasowang@redhat.com>
be904d
CC: Michael S. Tsirkin <mst@redhat.com>
be904d
be904d
Signed-off-by: Juan Quintela <quintela@redhat.com>
be904d
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
be904d
---
be904d
 hw/net/virtio-net.c | 1 +
be904d
 1 file changed, 1 insertion(+)
be904d
be904d
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
be904d
index f325440d01..dabeb9e720 100644
be904d
--- a/hw/net/virtio-net.c
be904d
+++ b/hw/net/virtio-net.c
be904d
@@ -3091,6 +3091,7 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
be904d
     g_free(n->vlans);
be904d
 
be904d
     if (n->failover) {
be904d
+        device_listener_unregister(&n->primary_listener);
be904d
         g_free(n->primary_device_id);
be904d
         g_free(n->standby_id);
be904d
         qobject_unref(n->primary_device_dict);
be904d
-- 
be904d
2.27.0
be904d