Commit 2a63dd72 authored by Jiri Slaby's avatar Jiri Slaby Committed by Konrad Rzeszutek Wilk

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: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Milton Miller <miltonm@bga.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
parent c8ac3902
...@@ -575,8 +575,9 @@ static pci_ers_result_t pcifront_common_process(int cmd, ...@@ -575,8 +575,9 @@ static pci_ers_result_t pcifront_common_process(int cmd,
pcidev = pci_get_bus_and_slot(bus, devfn); pcidev = pci_get_bus_and_slot(bus, devfn);
if (!pcidev || !pcidev->driver) { if (!pcidev || !pcidev->driver) {
dev_err(&pcidev->dev, dev_err(&pdev->xdev->dev, "device or AER driver is NULL\n");
"device or driver is NULL\n"); if (pcidev)
pci_dev_put(pcidev);
return result; return result;
} }
pdrv = pcidev->driver; pdrv = pcidev->driver;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment