Skip to contentSkip to conversation

net: bmac: Fix read of MAC address from ROM

PATCH Applied Jeremy Kerr 2 participants 2 messages May 19, 2020 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 net: bmac: Fix read of MAC address from ROM

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 <[email protected]>.

---
 drivers/net/ethernet/apple/bmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/apple/bmac.c +1 -1
index a58185b1d8bf..3e3711b60d01 100644
@@ -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);
Signature · 1 line
2.17.1
maintainer Applied
#2 lore raw

From: Jeremy Kerr <[email protected]>
Date: Tue, 19 May 2020 09:05:58 +0800

Quoted 4 lines

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.

Quoted 8 lines

This change fixes the for-loop to only read/write six bytes.

Based on a proposed fix from Finn Thain <[email protected]>.

Applied, thanks.