]> git.proxmox.com Git - qemu.git/commitdiff
tap: clear vhost_net backend on cleanup
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 27 Oct 2010 18:03:43 +0000 (20:03 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Nov 2010 14:40:07 +0000 (08:40 -0600)
Frontends calling tap_get_vhost_net get an invalid pointer after the
peer backend has been deleted. Jason Wang <jasowang@redhat.com> reports
this leading to a crash in ack_features when we remove the vhost-net
bakend of a virtio nic.

The fix is simply to clear the backend pointer.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
net/tap.c

index 4afb314fde032bdd7ee15fa07047c8f7e4684438..937d9429eb5ac34d527d4fad918d7188b67fc391 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -279,6 +279,7 @@ static void tap_cleanup(VLANClientState *nc)
 
     if (s->vhost_net) {
         vhost_net_cleanup(s->vhost_net);
+        s->vhost_net = NULL;
     }
 
     qemu_purge_queued_packets(nc);