Skip to content

Commit

Permalink
[PATCH] b44: ensure valid mac addr
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gary Zambrano authored and Jeff Garzik committed Mar 29, 2006
1 parent bc0e1fc commit 391fc09
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/net/b44.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 391fc09

Please sign in to comment.