Skip to content

Commit

Permalink
bgmac: validate (and random if needed) MAC addr
Browse files Browse the repository at this point in the history
This adds check for a valid Ethernet MAC address and in case it is not,
it will generate a valid random one, such that the adapter is still
usable.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Rafał Miłecki authored and David S. Miller committed Feb 8, 2013
1 parent e5e6730 commit d166f21
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/broadcom/bgmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -1318,6 +1318,12 @@ static int bgmac_probe(struct bcma_device *core)
return -ENOTSUPP;
}

if (!is_valid_ether_addr(mac)) {
dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac);
eth_random_addr(mac);
dev_warn(&core->dev, "Using random MAC: %pM\n", mac);
}

/* Allocation and references */
net_dev = alloc_etherdev(sizeof(*bgmac));
if (!net_dev)
Expand Down

0 comments on commit d166f21

Please sign in to comment.