mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76: fix possible undetected invalid MAC address
Make sure the MAC address is checked before function returns. If CONFIG_OF is set and the device node is null, the function will return directly, and an invalid MAC address will not be checked. Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
84554a1fbb
commit
a116b0a6af
@@ -80,13 +80,14 @@ mt76_eeprom_override(struct mt76_dev *dev)
|
||||
const u8 *mac;
|
||||
|
||||
if (!np)
|
||||
return;
|
||||
goto out;
|
||||
|
||||
mac = of_get_mac_address(np);
|
||||
if (!IS_ERR_OR_NULL(mac))
|
||||
memcpy(dev->macaddr, mac, ETH_ALEN);
|
||||
#endif
|
||||
|
||||
out:
|
||||
if (!is_valid_ether_addr(dev->macaddr)) {
|
||||
eth_random_addr(dev->macaddr);
|
||||
dev_info(dev->dev,
|
||||
|
||||
Reference in New Issue
Block a user