PCI: fix reference leak in pci_get_dev_by_id()
authorGreg KH <gregkh@suse.de>
Thu, 21 Aug 2008 20:47:58 +0000 (13:47 -0700)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Thu, 21 Aug 2008 22:22:46 +0000 (15:22 -0700)
commitebca4f1bce1eb7b91a63c515db66316db9391221
treedd65b7eb4437bca869fc1f6c792e4e43684a1f1e
parentd6a9e9b40be7da84f82eb414c2ad98c5bb69986b
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>
drivers/pci/search.c