summary refs log tree commit diff stats
path: root/hw/pci
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2023-04-11 18:04:08 +0900
committerMichael S. Tsirkin <mst@redhat.com>2023-07-10 18:59:32 -0400
commit08f632848008544b7e1ab8a8aa50df02c39a26a1 (patch)
tree4c7f68e2ac16d41e2a7ed0afcb8700b3a34d7697 /hw/pci
parentc925f40a29906355b516bad4c6ef80d30cf971b6 (diff)
downloadfocaccia-qemu-08f632848008544b7e1ab8a8aa50df02c39a26a1.tar.gz
focaccia-qemu-08f632848008544b7e1ab8a8aa50df02c39a26a1.zip
pcie: Release references of virtual functions
pci_new() automatically retains a reference to a virtual function when
registering it so we need to release the reference when unregistering.

Fixes: 7c0fa8dff8 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20230411090408.48366-1-akihiko.odaki@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'hw/pci')
-rw-r--r--hw/pci/pcie_sriov.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index aa5a757b11..76a3b6917e 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -211,6 +211,7 @@ static void unregister_vfs(PCIDevice *dev)
             error_free(local_err);
         }
         object_unparent(OBJECT(vf));
+        object_unref(OBJECT(vf));
     }
     g_free(dev->exp.sriov_pf.vf);
     dev->exp.sriov_pf.vf = NULL;