diff options
author | Gary Zambrano <zambrano@broadcom.com> | 2006-03-29 00:57:38 +0200 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-30 00:34:02 +0200 |
commit | 391fc09a143aac08d1a3dc37b60238612b504ad3 (patch) | |
tree | a4be557a7d86958eb360bf6ac1024b7ec88bb618 | |
parent | [PATCH] Janitor: drivers/net/pcnet32: fix incorrect comments (diff) | |
download | linux-391fc09a143aac08d1a3dc37b60238612b504ad3.tar.xz linux-391fc09a143aac08d1a3dc37b60238612b504ad3.zip |
[PATCH] b44: ensure valid mac addr
Added code to check for invalid MAC address from eeprom or user input.
Signed-off-by: Gary Zambrano <zambrano@broadcom.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
-rw-r--r-- | drivers/net/b44.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c index 2eab2a88c7bf..15032f2c7817 100644 --- a/drivers/net/b44.c +++ b/drivers/net/b44.c @@ -1339,6 +1339,9 @@ static int b44_set_mac_addr(struct net_device *dev, void *p) if (netif_running(dev)) return -EBUSY; + if (!is_valid_ether_addr(addr->sa_data)) + return -EINVAL; + memcpy(dev->dev_addr, addr->sa_data, dev->addr_len); spin_lock_irq(&bp->lock); @@ -1876,6 +1879,12 @@ static int __devinit b44_get_invariants(struct b44 *bp) bp->dev->dev_addr[3] = eeprom[80]; bp->dev->dev_addr[4] = eeprom[83]; bp->dev->dev_addr[5] = eeprom[82]; + + if (!is_valid_ether_addr(&bp->dev->dev_addr[0])){ + printk(KERN_ERR PFX "Invalid MAC address found in EEPROM\n"); + return -EINVAL; + } + memcpy(bp->dev->perm_addr, bp->dev->dev_addr, bp->dev->addr_len); bp->phy_addr = eeprom[90] & 0x1f; |