From: Jon Mason <jon.mason@broadcom.com>
To: David Miller <davem@davemloft.net>
Cc: rafal@milecki.pl, bcm-kernel-feedback-list@broadcom.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Hari Vyas <hariv@broadcom.com>
Subject: [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug
Date: Fri, 3 Feb 2017 16:08:53 -0500 [thread overview]
Message-ID: <1486156133-5639-3-git-send-email-jon.mason@broadcom.com> (raw)
In-Reply-To: <1486156133-5639-1-git-send-email-jon.mason@broadcom.com>
From: Hari Vyas <hariv@broadcom.com>
ndo_set_mac_address() passes struct sockaddr * as 2nd parameter to
bgmac_set_mac_address() but code assumed u8 *. This caused two bytes
chopping and the wrong mac address was configured.
Signed-off-by: Hari Vyas <hariv@broadcom.com>
Signed-off-by: Jon Mason <jon.mason@broadcom.com>
Fixes: 4e209001b86 ("bgmac: write mac address to hardware in ndo_set_mac_address")
---
drivers/net/ethernet/broadcom/bgmac.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 0e066dc6..737be50 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -1221,12 +1221,16 @@ static netdev_tx_t bgmac_start_xmit(struct sk_buff *skb,
static int bgmac_set_mac_address(struct net_device *net_dev, void *addr)
{
struct bgmac *bgmac = netdev_priv(net_dev);
+ struct sockaddr *sa = addr;
int ret;
ret = eth_prepare_mac_addr_change(net_dev, addr);
if (ret < 0)
return ret;
- bgmac_write_mac_address(bgmac, (u8 *)addr);
+
+ ether_addr_copy(bgmac->mac_addr, sa->sa_data);
+ bgmac_write_mac_address(bgmac, bgmac->mac_addr);
+
eth_commit_mac_addr_change(net_dev, addr);
return 0;
}
--
2.7.4
next prev parent reply other threads:[~2017-02-03 21:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-03 21:08 [PATCH v2 0/2] net: ethernet: bgmac: bug fixes Jon Mason
2017-02-03 21:08 ` [PATCH v2 1/2] net: ethernet: bgmac: init sequence bug Jon Mason
2017-02-03 21:41 ` Rafał Miłecki
2017-02-03 22:34 ` Jon Mason
2017-02-03 21:08 ` Jon Mason [this message]
2017-02-03 21:44 ` [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug Rafał Miłecki
2017-02-03 21:49 ` Florian Fainelli
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=1486156133-5639-3-git-send-email-jon.mason@broadcom.com \
--to=jon.mason@broadcom.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=hariv@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rafal@milecki.pl \
/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).