Skip to content

Commit fa42245

Browse files
Hari Vyasdavem330
authored andcommitted
net: ethernet: bgmac: mac address change bug
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: Hari Vyas <[email protected]> Signed-off-by: Jon Mason <[email protected]> Fixes: 4e20900 ("bgmac: write mac address to hardware in ndo_set_mac_address") Signed-off-by: David S. Miller <[email protected]>
1 parent 1620652 commit fa42245

File tree

1 file changed

+5
-1
lines changed
  • drivers/net/ethernet/broadcom

1 file changed

+5
-1
lines changed

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,12 +1223,16 @@ static netdev_tx_t bgmac_start_xmit(struct sk_buff *skb,
12231223
static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
12241224
{
12251225
struct bgmac *bgmac = netdev_priv(net_dev);
1226+
struct sockaddr *sa = addr;
12261227
int ret;
12271228

12281229
ret = eth_prepare_mac_addr_change(net_dev, addr);
12291230
if (ret < 0)
12301231
return ret;
1231-
bgmac_write_mac_address(bgmac, (u8 *)addr);
1232+
1233+
ether_addr_copy(net_dev->dev_addr, sa->sa_data);
1234+
bgmac_write_mac_address(bgmac, net_dev->dev_addr);
1235+
12321236
eth_commit_mac_addr_change(net_dev, addr);
12331237
return 0;
12341238
}

0 commit comments

Comments
 (0)