Commit 8dd692a3 authored by Jeremy Kerr's avatar Jeremy Kerr Committed by Khalid Elmously

net: bmac: Fix read of MAC address from ROM

BugLink: https://bugs.launchpad.net/bugs/1883918

[ Upstream commit ef01cee2 ]

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: default avatarJeremy Kerr <jk@ozlabs.org>
Reported-by: default avatarStan Johnson <userm57@yahoo.com>
Tested-by: default avatarStan Johnson <userm57@yahoo.com>
Reported-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent 5cb732dc
......@@ -1187,7 +1187,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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment