[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4AAB133B.8070900@ring3k.org>
Date: Sat, 12 Sep 2009 12:19:23 +0900
From: Mike McCormack <mikem@...g3k.org>
To: Stephen Hemminger <shemminger@...ux-foundation.org>
CC: netdev@...r.kernel.org
Subject: [PATCH] sky2: Make hw->ports the number of ports allocated
If allocation of the second ports fails, make sure that hw->ports
is not 2 otherwise we'll crash trying to access the second port.
Signed-off-by: Mike McCormack <mikem@...g3k.org>
---
drivers/net/sky2.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 018aa58..c17ee26 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4563,6 +4563,10 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
free_netdev(dev1);
} else
sky2_show_addr(dev1);
+
+ /* couldn't allocate the second port */
+ if (!hw->dev[1])
+ --hw->ports;
}
setup_timer(&hw->watchdog_timer, sky2_watchdog, (unsigned long) hw);
--
1.5.6.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists