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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211015235130.6sulfh2ouqt3dgfh@skbuf>
Date:   Sat, 16 Oct 2021 02:51:30 +0300
From:   Vladimir Oltean <olteanv@...il.com>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, andrew@...n.ch, idosch@...sch.org,
        f.fainelli@...il.com, vkochan@...vell.com, tchornyi@...vell.com
Subject: Re: [RFC net-next 3/6] ethernet: prestera: use eth_hw_addr_set_port()

On Fri, Oct 15, 2021 at 12:38:45PM -0700, Jakub Kicinski wrote:
> Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
> of VLANs...") introduced a rbtree for faster Ethernet address look
> up. To maintain netdev->dev_addr in this tree we need to make all
> the writes to it got through appropriate helpers.
> 
> We need to make sure the last byte is zeroed.
> 
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> CC: vkochan@...vell.com
> CC: tchornyi@...vell.com
> ---
>  drivers/net/ethernet/marvell/prestera/prestera_main.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> index b667f560b931..7d179927dabe 100644
> --- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
> +++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
> @@ -290,6 +290,7 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
>  {
>  	struct prestera_port *port;
>  	struct net_device *dev;
> +	u8 addr[ETH_ALEN] = {};
>  	int err;
>  
>  	dev = alloc_etherdev(sizeof(*port));
> @@ -341,8 +342,8 @@ static int prestera_port_create(struct prestera_switch *sw, u32 id)
>  	/* firmware requires that port's MAC address consist of the first
>  	 * 5 bytes of the base MAC address
>  	 */
> -	memcpy(dev->dev_addr, sw->base_mac, dev->addr_len - 1);
> -	dev->dev_addr[dev->addr_len - 1] = port->fp_id;
> +	memcpy(addr, sw->base_mac, dev->addr_len - 1);
> +	eth_hw_addr_set_port(dev, addr, port->fp_id);

Instead of having yet another temporary copy, can't we zero out
sw->base_mac[ETH_ALEN - 1] in prestera_switch_set_base_mac_addr()?

>  
>  	err = prestera_hw_port_mac_set(port, dev->dev_addr);
>  	if (err) {
> -- 
> 2.31.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ