Commit d166f218 authored by Rafał Miłecki's avatar Rafał Miłecki Committed by David S. Miller

bgmac: validate (and random if needed) MAC addr

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: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e5e67305
...@@ -1318,6 +1318,12 @@ static int bgmac_probe(struct bcma_device *core) ...@@ -1318,6 +1318,12 @@ static int bgmac_probe(struct bcma_device *core)
return -ENOTSUPP; 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 */ /* Allocation and references */
net_dev = alloc_etherdev(sizeof(*bgmac)); net_dev = alloc_etherdev(sizeof(*bgmac));
if (!net_dev) if (!net_dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment