diff options
author | Stephen Hemminger <shemminger@osdl.org> | 2006-04-05 17:47:15 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-04-17 13:16:04 -0700 |
commit | 8abb9bed57d5ee0f645eedb7208e8d53b2431b01 (patch) | |
tree | a129f301b51d935dd2e2814e9a2ff0bfb81015b3 | |
parent | 905ea1183cb0a6e82ab6de4d4ea0ff0bf807ff27 (diff) |
[PATCH] sky2: bad memory reference on dual port cards
Sky2 driver will oops referencing bad memory if used on
a dual port card. The problem is accessing past end of
MIB counter space.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/net/sky2.c | 4 | ||||
-rw-r--r-- | drivers/net/sky2.h | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 73260364cba..0618cd55aa3 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c @@ -579,8 +579,8 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) reg = gma_read16(hw, port, GM_PHY_ADDR); gma_write16(hw, port, GM_PHY_ADDR, reg | GM_PAR_MIB_CLR); - for (i = 0; i < GM_MIB_CNT_SIZE; i++) - gma_read16(hw, port, GM_MIB_CNT_BASE + 8 * i); + for (i = GM_MIB_CNT_BASE; i <= GM_MIB_CNT_END; i += 4) + gma_read16(hw, port, i); gma_write16(hw, port, GM_PHY_ADDR, reg); /* transmit control */ diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index dce955c76f3..c91e0a4a4be 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h @@ -1380,6 +1380,7 @@ enum { /* MIB Counters */ #define GM_MIB_CNT_BASE 0x0100 /* Base Address of MIB Counters */ #define GM_MIB_CNT_SIZE 44 /* Number of MIB Counters */ +#define GM_MIB_CNT_END 0x025C /* Last MIB counter */ /* * MIB Counters base address definitions (low word) - |