From: Shayne Chen <shayne.chen@mediatek.com>
To: Felix Fietkau <nbd@nbd.name>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
linux-wireless <linux-wireless@vger.kernel.org>,
linux-mediatek <linux-mediatek@lists.infradead.org>,
Roy Luo <royluo@google.com>,
Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Shayne Chen <shayne.chen@mediatek.com>
Subject: [PATCH] mt76: fix possible undetected invalid MAC address
Date: Tue, 26 Nov 2019 21:15:54 +0800 [thread overview]
Message-ID: <20191126131554.32457-1-shayne.chen@mediatek.com> (raw)
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>
---
drivers/net/wireless/mediatek/mt76/eeprom.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wireless/mediatek/mt76/eeprom.c
index 804224e81103..358fb0a1e523 100644
--- a/drivers/net/wireless/mediatek/mt76/eeprom.c
+++ b/drivers/net/wireless/mediatek/mt76/eeprom.c
@@ -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,
--
2.17.1
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
reply other threads:[~2019-11-26 13:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191126131554.32457-1-shayne.chen@mediatek.com \
--to=shayne.chen@mediatek.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=lorenzo@kernel.org \
--cc=nbd@nbd.name \
--cc=royluo@google.com \
--cc=ryder.lee@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).