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]
Date: Fri, 9 Jun 2023 19:00:11 +0200
From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
To: Piotr Gardocki <piotrx.gardocki@...el.com>
CC: <netdev@...r.kernel.org>, <przemyslaw.kitszel@...el.com>,
	<michal.swiatkowski@...ux.intel.com>, <pmenzel@...gen.mpg.de>,
	<kuba@...nel.org>, <anthony.l.nguyen@...el.com>, <simon.horman@...igine.com>,
	<aleksander.lobakin@...el.com>
Subject: Re: [PATCH net-next] net: add check for current MAC address in
 dev_set_mac_address

On Fri, Jun 09, 2023 at 06:52:41PM +0200, Piotr Gardocki wrote:

Hey Piotr,

> In some cases it is possible for kernel to come with request
> to change primary MAC address to the address that is already
> set on the given interface.
> 
> This patch adds proper check to return fast from the function
> in these cases.
> 
> An example of such case is adding an interface to bonding
> channel in balance-alb mode:
> modprobe bonding mode=balance-alb miimon=100 max_bonds=1
> ip link set bond0 up
> ifenslave bond0 <eth>
> 
> Signed-off-by: Piotr Gardocki <piotrx.gardocki@...el.com>
> ---
>  net/core/dev.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 99d99b247bc9..c2c3ec61397b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -8820,6 +8820,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
>  		return -EINVAL;
>  	if (!netif_device_present(dev))
>  		return -ENODEV;
> +	if (ether_addr_equal(dev->dev_addr, sa->sa_data))
> +		return 0;

Now this check being in makes calls to ether_addr_equal() within driver's
ndo callbacks redundant.

I would rather see this as patchset send directly to netdev where you have
this patch followed by addressing driver's callbacks.

Moar commitz == moar glory ;)

>  	err = dev_pre_changeaddr_notify(dev, sa->sa_data, extack);
>  	if (err)
>  		return err;
> -- 
> 2.34.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ