Skip to content

Commit

Permalink
cxgb3: Fix potential msi-x vector leak
Browse files Browse the repository at this point in the history
Release vectors when a MSI-X allocation fails.

Signed-off-by: Divy Le Ray <divy@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Divy Le Ray authored and David S. Miller committed Apr 20, 2009
1 parent c80b0c2 commit 2c2f409
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/cxgb3/cxgb3_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2917,8 +2917,13 @@ static int __devinit cxgb_enable_msix(struct adapter *adap)
while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
vectors = err;

if (!err && vectors < (adap->params.nports + 1))
if (err < 0)
pci_disable_msix(adap->pdev);

if (!err && vectors < (adap->params.nports + 1)) {
pci_disable_msix(adap->pdev);
err = -1;
}

if (!err) {
for (i = 0; i < vectors; ++i)
Expand Down

0 comments on commit 2c2f409

Please sign in to comment.