提交 d5af7d98 编写于 作者: J Jiang Liu 提交者: 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: NJiang Liu <jiang.liu@huawei.com>
Signed-off-by: NYinghai Lu <yinghai@kernel.org>
Signed-off-by: NBjorn Helgaas <bhelgaas@google.com>
Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
上级 7629d19a
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册