Skip to content

Commit bfc978f

Browse files
Amit Kumar Salechadavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a1745f commit bfc978f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/net/qlcnic/qlcnic_main.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2695,9 +2695,14 @@ static int qlcnic_is_first_func(struct pci_dev *pdev)
26952695
oth_pdev = pci_get_domain_bus_and_slot(pci_domain_nr
26962696
(pdev->bus), pdev->bus->number,
26972697
PCI_DEVFN(PCI_SLOT(pdev->devfn), val));
2698+
if (!oth_pdev)
2699+
continue;
26982700

2699-
if (oth_pdev && (oth_pdev->current_state != PCI_D3cold))
2701+
if (oth_pdev->current_state != PCI_D3cold) {
2702+
pci_dev_put(oth_pdev);
27002703
return 0;
2704+
}
2705+
pci_dev_put(oth_pdev);
27012706
}
27022707
return 1;
27032708
}

0 commit comments

Comments
 (0)