Skip to content

Commit

Permalink
xen-pcifront: fix PCI reference leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jiri Slaby authored and Konrad Rzeszutek Wilk committed Nov 8, 2010
1 parent c8ac390 commit 2a63dd7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/pci/xen-pcifront.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,8 +575,9 @@ static pci_ers_result_t pcifront_common_process(int cmd,

pcidev = pci_get_bus_and_slot(bus, devfn);
if (!pcidev || !pcidev->driver) {
dev_err(&pcidev->dev,
"device or driver is NULL\n");
dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
if (pcidev)
pci_dev_put(pcidev);
return result;
}
pdrv = pcidev->driver;
Expand Down

0 comments on commit 2a63dd7

Please sign in to comment.