aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorAjit Khaparde <ajitk@serverengines.com>2009-11-29 12:56:26 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-02 03:50:25 -0500
commitca9e4988ccbde3b11116679f1b023eb75df8017e (patch)
tree3cda7932ed04ccb634f94fdab4d81a165eba41ea /drivers/net
parent35a652859ad76d8bd989025952ecb80d7c5304a4 (diff)
be2net: check for valid ether address
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>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/benet/be_main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index e24f498f37cd..10262fab686b 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -125,6 +125,9 @@ static int be_mac_addr_set(struct net_device *netdev, void *p)
125 struct sockaddr *addr = p; 125 struct sockaddr *addr = p;
126 int status = 0; 126 int status = 0;
127 127
128 if (!is_valid_ether_addr(addr->sa_data))
129 return -EADDRNOTAVAIL;
130
128 status = be_cmd_pmac_del(adapter, adapter->if_handle, adapter->pmac_id); 131 status = be_cmd_pmac_del(adapter, adapter->if_handle, adapter->pmac_id);
129 if (status) 132 if (status)
130 return status; 133 return status;
@@ -2146,6 +2149,10 @@ static int be_get_config(struct be_adapter *adapter)
2146 MAC_ADDRESS_TYPE_NETWORK, true /*permanent */, 0); 2149 MAC_ADDRESS_TYPE_NETWORK, true /*permanent */, 0);
2147 if (status) 2150 if (status)
2148 return status; 2151 return status;
2152
2153 if (!is_valid_ether_addr(mac))
2154 return -EADDRNOTAVAIL;
2155
2149 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN); 2156 memcpy(adapter->netdev->dev_addr, mac, ETH_ALEN);
2150 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN); 2157 memcpy(adapter->netdev->perm_addr, mac, ETH_ALEN);
2151 2158