From ae50b2747f77944faa79eb914272b54eb30b63b3 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 1 Jul 2009 16:46:38 +0100 Subject: 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 Signed-off-by: Anthony Liguori --- hw/qdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'hw/qdev.c') diff --git a/hw/qdev.c b/hw/qdev.c index 4c550094e2..83e98bf3ed 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -250,8 +250,9 @@ VLANClientState *qdev_get_vlan_client(DeviceState *dev, { NICInfo *nd = dev->nd; assert(nd); - return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, can_receive, - receive, receive_iov, cleanup, opaque); + nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, can_receive, + receive, receive_iov, cleanup, opaque); + return nd->vc; } -- cgit 1.4.1