mac80211, mt76: add fixes for recently discovered security issues
[openwrt/staging/hauke.git] / package / kernel / mt76 / patches / 100-Revert-of-net-pass-the-dst-buffer-to-of_get_mac_addr.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 23 Nov 2021 17:01:45 +0100
3 Subject: [PATCH] Revert "of: net: pass the dst buffer to of_get_mac_address()"
4
5 This reverts commit 4932c5d80153c336c77dbe8d7af9f8fdd879d01f.
6 ---
7
8 --- a/eeprom.c
9 +++ b/eeprom.c
10 @@ -107,9 +107,15 @@ mt76_eeprom_override(struct mt76_phy *ph
11 {
12 struct mt76_dev *dev = phy->dev;
13
14 +#ifdef CONFIG_OF
15 struct device_node *np = dev->dev->of_node;
16 + const u8 *mac = NULL;
17
18 - of_get_mac_address(np, phy->macaddr);
19 + if (np)
20 + mac = of_get_mac_address(np);
21 + if (!IS_ERR_OR_NULL(mac))
22 + ether_addr_copy(phy->macaddr, mac);
23 +#endif
24
25 if (!is_valid_ether_addr(phy->macaddr)) {
26 eth_random_addr(phy->macaddr);