]> Pileus Git - ~andy/linux/commitdiff
qlcnic: fix pci resource leak
authorAmit Kumar Salecha <amit.salecha@qlogic.com>
Sun, 18 Jul 2010 21:51:59 +0000 (14:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 18 Jul 2010 21:51:59 +0000 (14:51 -0700)
pci_get_domain_bus_and_slot: caller must decrement the
reference count by calling pci_dev_put().

Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/qlcnic/qlcnic_main.c

index 8d2d62ff1a37487ed729d649ceb14e113d3e9bd8..f1f7acfbf412a661405e32ef37cacf5995afe737 100644 (file)
@@ -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;
 }