pci_get_domain_bus_and_slot will incease refcount of l_dev, there
should be a pci_dev_put(l_dev) to decrease the refcount, otherwise
the resource will not be free.

Signed-off-by: Flynn xu <[email protected]>
---
 driver/pci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/driver/pci.c b/driver/pci.c
index 8ba74bfd..f4fee561 100644
--- a/driver/pci.c
+++ b/driver/pci.c
@@ -103,8 +103,10 @@ static void jailhouse_pci_remove_device(const struct 
jailhouse_pci_device *dev)
 
        l_dev = pci_get_domain_bus_and_slot(dev->domain, PCI_BUS_NUM(dev->bdf),
                                            dev->bdf & 0xff);
-       if (l_dev)
+       if (l_dev) {
                pci_stop_and_remove_bus_device_locked(l_dev);
+               pci_dev_put(l_dev);
+       }
 }
 
 static void jailhouse_pci_claim_release(const struct jailhouse_pci_device *dev,
-- 
2.17.1

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to