Commit d5af7d98 authored by Jiang Liu's avatar Jiang Liu Committed by Bjorn Helgaas

PCI: Fix reference count leak in pci_dev_present()

Function pci_get_dev_by_id() takes a reference on the pci_dev returned, so
pci_dev_present() should release the corresponding reference.
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7629d19a
...@@ -319,13 +319,13 @@ int pci_dev_present(const struct pci_device_id *ids) ...@@ -319,13 +319,13 @@ int pci_dev_present(const struct pci_device_id *ids)
WARN_ON(in_interrupt()); WARN_ON(in_interrupt());
while (ids->vendor || ids->subvendor || ids->class_mask) { while (ids->vendor || ids->subvendor || ids->class_mask) {
found = pci_get_dev_by_id(ids, NULL); found = pci_get_dev_by_id(ids, NULL);
if (found) if (found) {
goto exit; pci_dev_put(found);
return 1;
}
ids++; ids++;
} }
exit:
if (found)
return 1;
return 0; return 0;
} }
EXPORT_SYMBOL(pci_dev_present); EXPORT_SYMBOL(pci_dev_present);
......
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