* [PATCH] net: bmac: Fix read of MAC address from ROM
[not found] <4863b7d34cf23d269921ad133dc585ec83a0bb63.camel@ozlabs.org>
@ 2020-05-19 1:05 ` Jeremy Kerr
2020-05-19 19:03 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jeremy Kerr @ 2020-05-19 1:05 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, David S. Miller, Benjamin Herrenschmidt,
Paul Mackerras, Finn Thain, Stan Johnson
In bmac_get_station_address, We're reading two bytes at a time from ROM,
but we do that six times, resulting in 12 bytes of read & writes. This
means we will write off the end of the six-byte destination buffer.
This change fixes the for-loop to only read/write six bytes.
Based on a proposed fix from Finn Thain <fthain@telegraphics.com.au>.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reported-by: Stan Johnson <userm57@yahoo.com>
Tested-by: Stan Johnson <userm57@yahoo.com>
Reported-by: Finn Thain <fthain@telegraphics.com.au>
---
drivers/net/ethernet/apple/bmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/apple/bmac.c b/drivers/net/ethernet/apple/bmac.c
index a58185b1d8bf..3e3711b60d01 100644
--- a/drivers/net/ethernet/apple/bmac.c
+++ b/drivers/net/ethernet/apple/bmac.c
@@ -1182,7 +1182,7 @@ bmac_get_station_address(struct net_device *dev, unsigned char *ea)
int i;
unsigned short data;
- for (i = 0; i < 6; i++)
+ for (i = 0; i < 3; i++)
{
reset_and_select_srom(dev);
data = read_srom(dev, i + EnetAddressOffset/2, SROMAddressBits);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: bmac: Fix read of MAC address from ROM
2020-05-19 1:05 ` [PATCH] net: bmac: Fix read of MAC address from ROM Jeremy Kerr
@ 2020-05-19 19:03 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-19 19:03 UTC (permalink / raw)
To: jk; +Cc: netdev, linux-kernel, benh, paulus, fthain, userm57
From: Jeremy Kerr <jk@ozlabs.org>
Date: Tue, 19 May 2020 09:05:58 +0800
> In bmac_get_station_address, We're reading two bytes at a time from ROM,
> but we do that six times, resulting in 12 bytes of read & writes. This
> means we will write off the end of the six-byte destination buffer.
>
> This change fixes the for-loop to only read/write six bytes.
>
> Based on a proposed fix from Finn Thain <fthain@telegraphics.com.au>.
>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> Reported-by: Stan Johnson <userm57@yahoo.com>
> Tested-by: Stan Johnson <userm57@yahoo.com>
> Reported-by: Finn Thain <fthain@telegraphics.com.au>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-19 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <4863b7d34cf23d269921ad133dc585ec83a0bb63.camel@ozlabs.org>
2020-05-19 1:05 ` [PATCH] net: bmac: Fix read of MAC address from ROM Jeremy Kerr
2020-05-19 19:03 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).