Subject: [ETH 01/04]: Validate address in eth_mac_addr

From: Patrick McHardy <[email-masked]>
Date: Wed, 11 Jul 2007 19:38:14 +0200 (MEST)

[ETH]: Validate address in eth_mac_addr

Signed-off-by: Patrick McHardy <[email-masked]>

---
commit 690fb4dbafa9f60f8cb520d5def544580107b3a4
tree ded62c0fcd8497b5cf9459213e1579cc700abb39
parent 99d24edeb6abc6ca3a0d0fbdb83c664c04403c8c
author Patrick McHardy <[email-masked]> Wed, 11 Jul 2007 19:23:22 +0200
committer Patrick McHardy <[email-masked]> Wed, 11 Jul 2007 19:23:22 +0200

 net/ethernet/eth.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 1387e54..12c7657 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -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;
 }