Skip to content
Permalink
Browse files

driver: pci: Fix refcount leak

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 <flynn.xu@nxp.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
  • Loading branch information...
Flynn Xu authored and jan-kiszka committed Feb 21, 2019
1 parent 2b9a200 commit f743631213a1f1e2cd007950b9b557501006260b
Showing with 3 additions and 1 deletion.
  1. +3 −1 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,

0 comments on commit f743631

Please sign in to comment.
You can’t perform that action at this time.