From: Ajit Khaparde Date: Sun, 29 Nov 2009 17:56:26 +0000 (+0000) Subject: be2net: check for valid ether address X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ca9e4988ccbde3b11116679f1b023eb75df8017e;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git be2net: check for valid ether address Allow only valid ether addresses to be assigned and used for the interface. Signed-off-by: Ajit Khaparde Signed-off-by: David S. Miller --- 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) 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; @@ -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);