Skip to content

Commit

Permalink
[ETH]: Validate address in eth_mac_addr
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Patrick McHardy authored and David S. Miller committed Jul 12, 2007
1 parent 50b65cc commit 71bffe5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ethernet/eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ void eth_header_cache_update(struct hh_cache *hh, struct net_device *dev,
static int eth_mac_addr(struct net_device *dev, void *p)
{
struct sockaddr *addr = p;

if (netif_running(dev))
return -EBUSY;
if (!is_valid_ether_addr(addr->sa_data))
return -EADDRNOTAVAIL;
memcpy(dev->dev_addr, addr->sa_data, dev->addr_len);
return 0;
}
Expand Down

0 comments on commit 71bffe5

Please sign in to comment.