Commit 174e03cd authored by Hari Vyas's avatar Hari Vyas Committed by Ben Hutchings

net: ethernet: bgmac: mac address change bug

commit fa42245d upstream.

ndo_set_mac_address() passes struct sockaddr * as 2nd parameter to
bgmac_set_mac_address() but code assumed u8 *.  This caused two bytes
chopping and the wrong mac address was configured.
Signed-off-by: default avatarHari Vyas <hariv@broadcom.com>
Signed-off-by: default avatarJon Mason <jon.mason@broadcom.com>
Fixes: 4e209001 ("bgmac: write mac address to hardware in ndo_set_mac_address")
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 454b5e15
......@@ -1238,12 +1238,16 @@ static netdev_tx_t bgmac_start_xmit(struct sk_buff *skb,
static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
{
struct bgmac *bgmac = netdev_priv(net_dev);
struct sockaddr *sa = addr;
int ret;
ret = eth_prepare_mac_addr_change(net_dev, addr);
if (ret < 0)
return ret;
bgmac_write_mac_address(bgmac, (u8 *)addr);
ether_addr_copy(net_dev->dev_addr, sa->sa_data);
bgmac_write_mac_address(bgmac, net_dev->dev_addr);
eth_commit_mac_addr_change(net_dev, addr);
return 0;
}
......
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