mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix
@ 2009-12-02 13:45 Stanislav Brabec
  2009-12-02 14:35 ` Stanislav Brabec
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislav Brabec @ 2009-12-02 13:45 UTC (permalink / raw)
  To: Gary Zambrano; +Cc: Linux Kernel Mailing List

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 on 2006-06-20.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 2a91323..4869adb 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)
 		for (k = 0; k< ethaddr_bytes; k++) {
 			ppattern[offset + magicsync +
 				(j * ETH_ALEN) + k] = macaddr[k];
-			len++;
-			set_bit(len, (unsigned long *) pmask);
+			set_bit(len++, (unsigned long *) pmask);
 		}
 	}
 	return len - 1;


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix
  2009-12-02 13:45 [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix Stanislav Brabec
@ 2009-12-02 14:35 ` Stanislav Brabec
  2009-12-02 23:42   ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislav Brabec @ 2009-12-02 14:35 UTC (permalink / raw)
  To: Gary Zambrano; +Cc: Linux Kernel Mailing List, stable

Stanislav Brabec wrote:
> 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 on 2006-06-20.

stable@kernel.org may be interested as well. Adding Cc:.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: stable@kernel.org


diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 2a91323..4869adb 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)
 		for (k = 0; k< ethaddr_bytes; k++) {
 			ppattern[offset + magicsync +
 				(j * ETH_ALEN) + k] = macaddr[k];
-			len++;
-			set_bit(len, (unsigned long *) pmask);
+			set_bit(len++, (unsigned long *) pmask);
 		}
 	}
 	return len - 1;



-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix
  2009-12-02 14:35 ` Stanislav Brabec
@ 2009-12-02 23:42   ` David Miller
  2009-12-03 14:56     ` Stanislav Brabec
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2009-12-02 23:42 UTC (permalink / raw)
  To: sbrabec; +Cc: zambrano, linux-kernel, stable

From: Stanislav Brabec <sbrabec@suse.cz>
Date: Wed, 02 Dec 2009 15:35:20 +0100

> Stanislav Brabec wrote:
>> 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 on 2006-06-20.
> 
> stable@kernel.org may be interested as well. Adding Cc:.

netdev@vger.kernel.org is even more interested.  Please post all
networking patches CC:'d there so they get properly logged
and tracked in patchwork.

Thank you.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix
  2009-12-02 23:42   ` David Miller
@ 2009-12-03 14:56     ` Stanislav Brabec
  2009-12-09  5:00       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Stanislav Brabec @ 2009-12-03 14:56 UTC (permalink / raw)
  To: David Miller; +Cc: zambrano, linux-kernel, stable, netdev

David Miller wrote:
> From: Stanislav Brabec <sbrabec@suse.cz>
> Date: Wed, 02 Dec 2009 15:35:20 +0100
> >> 
> >> It seems that this problem affects all kernel versions since commit
> >> 725ad800 on 2006-06-20.
> > 
> > stable@kernel.org may be interested as well. Adding Cc:.
> 
> netdev@vger.kernel.org is even more interested.  Please post all
> networking patches CC:'d there so they get properly logged
> and tracked in patchwork.

OK, sending again with another Cc::

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 on 2006-06-20.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: netdev@vger.kernel.org
Cc: stable@kernel.org
Cc: Gary Zambrano <zambrano@broadcom.com>

diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index 2a91323..4869adb 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)
                for (k = 0; k< ethaddr_bytes; k++) {
                        ppattern[offset + magicsync +
                                (j * ETH_ALEN) + k] = macaddr[k];
-                       len++;
-                       set_bit(len, (unsigned long *) pmask);
+                       set_bit(len++, (unsigned long *) pmask);
                }
        }
        return len - 1;


-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                          e-mail: sbrabec@suse.cz
Lihovarská 1060/12           tel: +420 284 028 966, +49 911 740538747
190 00 Praha 9                                  fax: +420 284 028 951
Czech Republic                                    http://www.suse.cz/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix
  2009-12-03 14:56     ` Stanislav Brabec
@ 2009-12-09  5:00       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-12-09  5:00 UTC (permalink / raw)
  To: sbrabec; +Cc: zambrano, linux-kernel, stable, netdev

From: Stanislav Brabec <sbrabec@suse.cz>
Date: Thu, 03 Dec 2009 15:56:28 +0100

> 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 on 2006-06-20.
> 
> Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-12-09  5:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-02 13:45 [PATCH][stable] b44 WOL setup: one-bit-off stack corruption kernel panic fix Stanislav Brabec
2009-12-02 14:35 ` Stanislav Brabec
2009-12-02 23:42   ` David Miller
2009-12-03 14:56     ` Stanislav Brabec
2009-12-09  5:00       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®