summary refs log tree commit diff stats
path: root/hw/device-hotplug.c
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2009-07-01 16:46:38 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2009-07-09 16:58:07 -0500
commitae50b2747f77944faa79eb914272b54eb30b63b3 (patch)
tree836a0fb70b51d1ca20f11afcae2a91f5c5ca637d /hw/device-hotplug.c
parentd026fb6dab9483869897d9d762311db8895ecca5 (diff)
downloadfocaccia-qemu-ae50b2747f77944faa79eb914272b54eb30b63b3.tar.gz
focaccia-qemu-ae50b2747f77944faa79eb914272b54eb30b63b3.zip
Don't leak VLANClientState on PCI hot remove
destroy_nic() requires that NICInfo::private by a PCIDevice pointer,
but then goes on to require that the same pointer matches
VLANClientState::opaque.

That is no longer the case for virtio-net since qdev and wasn't
previously the case for rtl8139, ne2k_pci or eepro100.

Make the situation a lot more clear by maintaining a VLANClientState
pointer in NICInfo.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/device-hotplug.c')
-rw-r--r--hw/device-hotplug.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/hw/device-hotplug.c b/hw/device-hotplug.c
index 3bdc048c68..e178083419 100644
--- a/hw/device-hotplug.c
+++ b/hw/device-hotplug.c
@@ -55,12 +55,7 @@ void destroy_nic(dev_match_fn *match_fn, void *arg)
         nic = &nd_table[i];
         if (nic->used) {
             if (nic->private && match_fn(nic->private, arg)) {
-                if (nic->vlan) {
-                    VLANClientState *vc;
-                    vc = qemu_find_vlan_client(nic->vlan, nic->private);
-                    if (vc)
-                        qemu_del_vlan_client(vc);
-                }
+                qemu_del_vlan_client(nic->vc);
                 net_client_uninit(nic);
             }
         }