提交 d4c158b0 编写于 作者: J Jeremy Kerr 提交者: Yang Yingliang

net: bmac: Fix read of MAC address from ROM

[ 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: NJeremy Kerr <jk@ozlabs.org>
Reported-by: NStan Johnson <userm57@yahoo.com>
Tested-by: NStan Johnson <userm57@yahoo.com>
Reported-by: NFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 379bac6b
......@@ -1181,7 +1181,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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册