lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1bbaa5ff-0819-41f0-9ca5-73de287c9d08@broadcom.com>
Date: Thu, 23 Oct 2025 10:14:56 -0700
From: Florian Fainelli <florian.fainelli@...adcom.com>
To: Paul SAGE <paul.sage@...fr>, vinc@...fr
Cc: Pavan Chebbi <pavan.chebbi@...adcom.com>,
 Michael Chan <mchan@...adcom.com>, Andrew Lunn <andrew+netdev@...n.ch>,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tg3: replace placeholder MAC address with device property

On 10/23/25 09:08, Paul SAGE wrote:
> On some systems (e.g. iMac 20,1 with BCM57766), the tg3 driver reads a default placeholder mac address (00:10:18:00:00:00) from the mailbox.
> The correct value on those systems are stored in the 'local-mac-address' property.
> 
> This patch, detect the default value and tries to retrieve the correct address from the device_get_mac_address function instead.
> 
> The patch has been tested on two different systems:
> - iMac 20,1 (BCM57766) model which use the local-mac-address property
> - iMac 13,2 (BCM57766) model which can use the mailbox, NVRAM or MAC control registers
> 
> Co-developed-by: Vincent MORVAN <vinc@...fr>
> Signed-off-by: Vincent MORVAN <vinc@...fr>
> Signed-off-by: Paul SAGE <paul.sage@...fr>
> ---
>   drivers/net/ethernet/broadcom/tg3.c | 12 ++++++++++++
>   drivers/net/ethernet/broadcom/tg3.h |  2 ++
>   2 files changed, 14 insertions(+)
> 
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index d78cafdb2094..55c2f2804df5 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -17042,6 +17042,14 @@ static int tg3_get_invariants(struct tg3 *tp, const struct pci_device_id *ent)
>   	return err;
>   }
>   
> +static int tg3_is_default_mac_address(u8 *addr)
> +{
> +	u32 addr_high = (addr[0] << 16) | (addr[1] << 8) | addr[2];
> +	u32 addr_low = (addr[3] << 16) | (addr[4] <<  8) | addr[5];
> +
> +	return addr_high == BROADCOM_OUI && addr_low == 0;
> +}
> +
>   static int tg3_get_device_address(struct tg3 *tp, u8 *addr)
>   {
>   	u32 hi, lo, mac_offset;
> @@ -17115,6 +17123,10 @@ static int tg3_get_device_address(struct tg3 *tp, u8 *addr)
>   
>   	if (!is_valid_ether_addr(addr))
>   		return -EINVAL;
> +
> +	if (tg3_is_default_mac_address(addr))
> +		device_get_mac_address(&tp->pdev->dev, addr);
> +
>   	return 0;
>   }
>   
> diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
> index a9e7f88fa26d..9fb226772e79 100644
> --- a/drivers/net/ethernet/broadcom/tg3.h
> +++ b/drivers/net/ethernet/broadcom/tg3.h
> @@ -14,6 +14,8 @@
>   #ifndef _T3_H
>   #define _T3_H
>   
> +#define BROADCOM_OUI			0x00001018

There are multiple OUIs that Broadcom has used throughout the years, 
they are documented under include/linux/brcmphy.h, to avoid any 
confusion for people looking only at that driver, I would rather we find 
a different constant name, or we just don't use a constant.
-- 
Florian


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ