virtio-net: don't use vdev after virtio_cleanup
authorAmit Shah <amit.shah@redhat.com>
Wed, 27 Jul 2011 08:30:31 +0000 (14:00 +0530)
committerMichael S. Tsirkin <mst@redhat.com>
Wed, 27 Jul 2011 17:18:47 +0000 (20:18 +0300)
virtio_cleanup() will be changed by the following patch to remove the
VirtIONet struct that gets allocated via virtio_common_init().  Ensure
we don't dereference the structure after calling the cleanup function.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio-net.c

index 6997e02..09c665b 100644 (file)
@@ -1073,6 +1073,6 @@ void virtio_net_exit(VirtIODevice *vdev)
         qemu_bh_delete(n->tx_bh);
     }
 
-    virtio_cleanup(&n->vdev);
     qemu_del_vlan_client(&n->nic->nc);
+    virtio_cleanup(&n->vdev);
 }