Skip to contentSkip to conversation

mv643xx_eth: check for valid hw address

PATCH In review Denis Kirjanov <[email protected] 2 participants 4 messages Dec 4, 2009 – Dec 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mv643xx_eth: check for valid hw address

Check for valid hw address.

---
drivers/net/mv643xx_eth.c | 3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/mv643xx_eth.c +3 -0
index 796a493..0b85501 100644
@@ -1827,6 +1827,9 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
 {
 	struct sockaddr *sa = addr;
 
+	if (!is_valid_ether_addr(sa->sa_data))
+		return -EADDRNOTAVAIL;
+
 	memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
 
 	netif_addr_lock_bh(dev);
#2 lore raw

PATCH 1/1 mv643xx_eth: check for valid hw address (resubmit)

Quoted 9 lines · David Miller

From: "Denis Kirjanov <[email protected]" <[email protected]>
Date: Fri, 4 Dec 2009 14:51:38 +0300

Quoted 3 lines

Check for valid hw address.

Assuming we don't accept your other patch this needs to return -EINVAL.

(resubmitted due the fix in the return value)

Check for valid hw address.

---

 drivers/net/mv643xx_eth.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/net/mv643xx_eth.c +3 -0
index 796a493..1405a17 100644
@@ -1827,6 +1827,9 @@ static int mv643xx_eth_set_mac_address(struct net_device *dev, void *addr)
 {
 	struct sockaddr *sa = addr;
 
+	if (!is_valid_ether_addr(sa->sa_data))
+		return -EINVAL;
+
 	memcpy(dev->dev_addr, sa->sa_data, ETH_ALEN);
 
 	netif_addr_lock_bh(dev);