aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStanislav Brabec <sbrabec@suse.cz>2009-12-09 00:00:22 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-09 00:00:22 -0500
commite0188829cb724e7d12a2d4e343b368ff1d6e1471 (patch)
tree4aa935073040b11f6a8e2f55451fa80a8ffb3028
parent77722b177a1606669c0b95dde03347e37d13b8fe (diff)
b44 WOL setup: one-bit-off stack corruption kernel panic fix
About 50% of shutdowns of b44 Ethernet adapter ends by kernel panic with kernels compiled with stack-protector. Checking b44_magic_pattern() return values, one call of b44_magic_pattern() returns 127. It means, that set_bit(128, pmask) was called on line 1509. It means that bit 0 of 17th byte of pmask was overwritten. But pmask has only 16 bytes. Stack corruption happens. It seems that set_bit() on line 1509 always writes one bit off. The fix does not only solve the stack corruption, but also makes Wake On LAN working on my onboard B44 on Asus A7V-333X mainboard. It seems that this problem affects all kernel versions since commit 725ad800 ([PATCH] b44: add wol for old nic) on 2006-06-20. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/b44.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 2a9132343b66..4869adb69586 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1505,8 +1505,7 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
1505 for (k = 0; k< ethaddr_bytes; k++) { 1505 for (k = 0; k< ethaddr_bytes; k++) {
1506 ppattern[offset + magicsync + 1506 ppattern[offset + magicsync +
1507 (j * ETH_ALEN) + k] = macaddr[k]; 1507 (j * ETH_ALEN) + k] = macaddr[k];
1508 len++; 1508 set_bit(len++, (unsigned long *) pmask);
1509 set_bit(len, (unsigned long *) pmask);
1510 } 1509 }
1511 } 1510 }
1512 return len - 1; 1511 return len - 1;