diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-07-18 14:51:59 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-18 14:51:59 -0700 |
commit | bfc978fa5f3005e5dfb39c52393c3339f4f00233 (patch) | |
tree | 8993955e9e4c6156696811800ec6d44536e417c5 | |
parent | 4a1745fc54e22e9fa928d72f97ee0e91449c9fd0 (diff) | |
download | linux-3.10-bfc978fa5f3005e5dfb39c52393c3339f4f00233.tar.gz linux-3.10-bfc978fa5f3005e5dfb39c52393c3339f4f00233.tar.bz2 linux-3.10-bfc978fa5f3005e5dfb39c52393c3339f4f00233.zip |
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 <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/qlcnic/qlcnic_main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/net/qlcnic/qlcnic_main.c b/drivers/net/qlcnic/qlcnic_main.c index 8d2d62ff1a3..f1f7acfbf41 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; } |