Skip to content

Commit

Permalink
PCI: Fix reference count leak in pci_dev_present()
Browse files Browse the repository at this point in the history
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: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Jiang Liu authored and Bjorn Helgaas committed Jan 25, 2013
1 parent 7629d19 commit d5af7d9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/pci/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -319,13 +319,13 @@ int pci_dev_present(const struct pci_device_id *ids)
WARN_ON(in_interrupt());
while (ids->vendor || ids->subvendor || ids->class_mask) {
found = pci_get_dev_by_id(ids, NULL);
if (found)
goto exit;
if (found) {
pci_dev_put(found);
return 1;
}
ids++;
}
exit:
if (found)
return 1;

return 0;
}
EXPORT_SYMBOL(pci_dev_present);
Expand Down

0 comments on commit d5af7d9

Please sign in to comment.