Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Rafał Miłecki and committed by
David S. Miller
d166f218 e5e67305

+6
+6
drivers/net/ethernet/broadcom/bgmac.c
··· 1318 1318 return -ENOTSUPP; 1319 1319 } 1320 1320 1321 + if (!is_valid_ether_addr(mac)) { 1322 + dev_err(&core->dev, "Invalid MAC addr: %pM\n", mac); 1323 + eth_random_addr(mac); 1324 + dev_warn(&core->dev, "Using random MAC: %pM\n", mac); 1325 + } 1326 + 1321 1327 /* Allocation and references */ 1322 1328 net_dev = alloc_etherdev(sizeof(*bgmac)); 1323 1329 if (!net_dev)