From: Amit Kumar Salecha Date: Sun, 18 Jul 2010 21:51:59 +0000 (-0700) Subject: qlcnic: fix pci resource leak X-Git-Tag: v2.6.36-rc1~571^2~187 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bfc978fa5f3005e5dfb39c52393c3339f4f00233;p=platform%2Fkernel%2Flinux-stable.git qlcnic: fix pci resource leak pci_get_domain_bus_and_slot: caller must decrement the reference count by calling pci_dev_put(). Signed-off-by: Amit Kumar Salecha Signed-off-by: David S. Miller --- diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 8d2d62f..f1f7acf 100644 --- a/drivers/net/qlcnic/qlcnic_main.c +++ b/drivers/net/qlcnic/qlcnic_main.c @@ -2695,9 +2695,14 @@ static int qlcnic_is_first_func(struct pci_dev *pdev) oth_pdev = pci_get_domain_bus_and_slot(pci_domain_nr (pdev->bus), pdev->bus->number, PCI_DEVFN(PCI_SLOT(pdev->devfn), val)); + if (!oth_pdev) + continue; - if (oth_pdev && (oth_pdev->current_state != PCI_D3cold)) + if (oth_pdev->current_state != PCI_D3cold) { + pci_dev_put(oth_pdev); return 0; + } + pci_dev_put(oth_pdev); } return 1; }