Skip to content

Commit

Permalink
be2net: check for valid ether address
Browse files Browse the repository at this point in the history
Allow only valid ether addresses to be assigned and used for the interface.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ajit Khaparde authored and David S. Miller committed Dec 2, 2009
1 parent 35a6528 commit ca9e498
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
struct sockaddr *addr = p;
int status = 0;

if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;

status = be_cmd_pmac_del(adapter, adapter->if_handle, adapter->pmac_id);
if (status)
return status;
Expand Down Expand Up @@ -2146,6 +2149,10 @@ static int be_get_config(struct be_adapter *adapter)
MAC_ADDRESS_TYPE_NETWORK, true /*permanent */, 0);
if (status)
return status;

if (!is_valid_ether_addr(mac))
return -EADDRNOTAVAIL;

memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);

Expand Down

0 comments on commit ca9e498

Please sign in to comment.