]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mt76: fix possible undetected invalid MAC address
authorShayne Chen <shayne.chen@mediatek.com>
Tue, 26 Nov 2019 13:15:54 +0000 (21:15 +0800)
committerFelix Fietkau <nbd@nbd.name>
Fri, 14 Feb 2020 09:06:00 +0000 (10:06 +0100)
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 <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/eeprom.c

index 804224e81103ff08d3cf09a9a170d8ac1d15bd90..358fb0a1e5235dd138bf0b21b51fabf78ef43053 100644 (file)
@@ -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(mac))
                ether_addr_copy(dev->macaddr, mac);
 #endif
 
+out:
        if (!is_valid_ether_addr(dev->macaddr)) {
                eth_random_addr(dev->macaddr);
                dev_info(dev->dev,