2009-04-17 23:04:08

by Divy Le ray

[permalink] [raw]
Subject: [PATCH 2.6.30 3/4] cxgb3: Fix potential msi-x vector leak

From: Divy Le Ray <[email protected]>

Release vectors when a MSI-X allocation fails.

Signed-off-by: Divy Le Ray <[email protected]>
---

drivers/net/cxgb3/cxgb3_main.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c
index 99b5032..cbd59fe 100644
--- a/drivers/net/cxgb3/cxgb3_main.c
+++ b/drivers/net/cxgb3/cxgb3_main.c
@@ -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)


2009-04-20 09:09:21

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 2.6.30 3/4] cxgb3: Fix potential msi-x vector leak

From: Divy Le Ray <[email protected]>
Date: Fri, 17 Apr 2009 15:21:22 -0700

> Release vectors when a MSI-X allocation fails.
>
> Signed-off-by: Divy Le Ray <[email protected]>

Applied.