Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573436 > unrolled thread

[PATCH v2 2/2] net: ethernet: bgmac: mac address change bug

Started byJon Mason <jon.mason@broadcom.com>
First post2017-02-03 22:10 +0100
Last post2017-02-04 00:10 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug Jon Mason <jon.mason@broadcom.com> - 2017-02-03 22:10 +0100
    Re: [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug Florian Fainelli <f.fainelli@gmail.com> - 2017-02-03 22:50 +0100
    Re: [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug Rafał Miłecki <rafal@milecki.pl> - 2017-02-04 00:10 +0100

#1573436 — [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug

FromJon Mason <jon.mason@broadcom.com>
Date2017-02-03 22:10 +0100
Subject[PATCH v2 2/2] net: ethernet: bgmac: mac address change bug
Message-ID<t6Thf-7ai-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1573468

FromFlorian Fainelli <f.fainelli@gmail.com>
Date2017-02-03 22:50 +0100
Message-ID<t6TTY-7qD-19@gated-at.bofh.it>
In reply to#1573436
On 02/03/2017 01:44 PM, Rafał Miłecki wrote:
> On 02/03/2017 10:08 PM, Jon Mason wrote:
>> 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")
> 
> I think you were going to Cc stable?

David takes care of queueing patches for -stable trees:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.txt#n114
-- 
Florian

[toc] | [prev] | [next] | [standalone]


#1573506

FromRafał Miłecki <rafal@milecki.pl>
Date2017-02-04 00:10 +0100
Message-ID<t6TTY-7qD-21@gated-at.bofh.it>
In reply to#1573436
On 02/03/2017 10:08 PM, Jon Mason wrote:
> 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")

I think you were going to Cc stable?

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web