aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2010-11-04 10:31:30 -0400
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2010-11-08 11:41:15 -0500
commit2a63dd7275b2278bd7e9203f74b9aa4f07e82a7a (patch)
treeee4de02c580b1e41eed25242b0e978d2a1ed1359 /drivers/pci
parentc8ac3902fb7a98c45ed54d98ad6f1c8168f47021 (diff)
xen-pcifront: fix PCI reference leak
Stanse found that when pdev is found and has no driver a reference is leaked in pcifront_common_process. So add pci_dev_put there. For the pdev == NULL case, pci_dev_put(NULL) is fine. [v2: Updated to not dereference pcidev->dev per Milton's observation] Signed-off-by: Jiri Slaby <jslaby@suse.cz> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Milton Miller <miltonm@bga.com> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/xen-pcifront.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index 05792732718e..3a5a6fcc0ead 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -575,8 +575,9 @@ static pci_ers_result_t pcifront_common_process(int cmd,
575 575
576 pcidev = pci_get_bus_and_slot(bus, devfn); 576 pcidev = pci_get_bus_and_slot(bus, devfn);
577 if (!pcidev || !pcidev->driver) { 577 if (!pcidev || !pcidev->driver) {
578 dev_err(&pcidev->dev, 578 dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
579 "device or driver is NULL\n"); 579 if (pcidev)
580 pci_dev_put(pcidev);
580 return result; 581 return result;
581 } 582 }
582 pdrv = pcidev->driver; 583 pdrv = pcidev->driver;