Skip to contentSkip to conversation

virtio-net: fix removal of failover device

PATCH In review Juan Quintela 3 participants 3 messages Jul 3, 2020 – Jul 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-net: fix removal of failover device

If you have a networking device and its virtio failover device, and you remove them in this order:
- virtio device
- the real device

You get qemu crash.
See bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820120

Bug exist on qemu 4.2 and 5.0.
But in 5.0 don't shows because commit
77b06bba62034a87cc61a9c8de1309ae3e527d97

somehow papers over it.

CC Jason Wang <[email protected]>
CC Michael S. Tsirkin <[email protected]>
---
 hw/net/virtio-net.c | 1 +
 1 file changed, 1 insertion(+)
hw/net/virtio-net.c +1 -0
index 9bb5578e5d..8d84713df3 100644
@@ -3398,6 +3398,7 @@ static void virtio_net_device_unrealize(DeviceState *dev)
     g_free(n->vlans);
 
     if (n->failover) {
+        device_listener_unregister(&n->primary_listener);
         g_free(n->primary_device_id);
         g_free(n->standby_id);
         qobject_unref(n->primary_device_dict);
Signature · 1 line
2.25.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Juan Quintela

If you have a networking device and its virtio failover device, and you remove them in this order:
- virtio device
- the real device

You get qemu crash.
See bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820120

Bug exist on qemu 4.2 and 5.0.
But in 5.0 don't shows because commit
77b06bba62034a87cc61a9c8de1309ae3e527d97

Quoted 6 lines

somehow papers over it.

CC Jason Wang <[email protected]>
CC Michael S. Tsirkin <[email protected]>

Jason can you queue this pls?

Quoted 18 lines
---
 hw/net/virtio-net.c | 1 +
 1 file changed, 1 insertion(+)
hw/net/virtio-net.c +1 -0
index 9bb5578e5d..8d84713df3 100644
@@ -3398,6 +3398,7 @@ static void virtio_net_device_unrealize(DeviceState *dev)
     g_free(n->vlans);
 
     if (n->failover) {
+        device_listener_unregister(&n->primary_listener);
         g_free(n->primary_device_id);
         g_free(n->standby_id);
         qobject_unref(n->primary_device_dict);
Signature · 1 line
2.25.4
#2 lore raw
Quoted 15 lines · Michael S. Tsirkin
Quoted 14 lines · Juan Quintela

If you have a networking device and its virtio failover device, and you remove them in this order:
- virtio device
- the real device

You get qemu crash.
See bugzilla:https://bugzilla.redhat.com/show_bug.cgi?id=1820120

Bug exist on qemu 4.2 and 5.0.
But in 5.0 don't shows because commit
77b06bba62034a87cc61a9c8de1309ae3e527d97

somehow papers over it.

Quoted 8 lines
Quoted 4 lines
CC Jason Wang<[email protected]>
CC Michael S. Tsirkin<[email protected]>

Jason can you queue this pls?

Queued.

Thanks

Quoted 1 line