aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/search.c
diff options
context:
space:
mode:
authorGreg KH <gregkh@suse.de>2008-08-21 16:47:58 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-08-21 18:22:46 -0400
commitebca4f1bce1eb7b91a63c515db66316db9391221 (patch)
treedd65b7eb4437bca869fc1f6c792e4e43684a1f1e /drivers/pci/search.c
parentd6a9e9b40be7da84f82eb414c2ad98c5bb69986b (diff)
PCI: fix reference leak in pci_get_dev_by_id()
Alex Chiang and Matthew Wilcox pointed out that pci_get_dev_by_id() does not properly decrement the reference on the from pointer if it is present, like the documentation for the function states it will. It fixes a pretty bad leak in the hotplug core (we were leaking an entire struct pci_dev for each function of each offlined card, the first time around; subsequent onlines/offlines were ok). Cc: Matthew Wilcox <matthew@wil.cx> Cc: stable <stable@kernel.org> Tested-by: Alex Chiang <achiang@hp.com> Acked-by: Alex Chiang <achiang@hp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/search.c')
-rw-r--r--drivers/pci/search.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 217814fef4ef..3b3b5f178797 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -280,6 +280,8 @@ static struct pci_dev *pci_get_dev_by_id(const struct pci_device_id *id,
280 match_pci_dev_by_id); 280 match_pci_dev_by_id);
281 if (dev) 281 if (dev)
282 pdev = to_pci_dev(dev); 282 pdev = to_pci_dev(dev);
283 if (from)
284 pci_dev_put(from);
283 return pdev; 285 return pdev;
284} 286}
285 287