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: <DM4PR11MB611742AD2CC964B5C8DFE6A28255A@DM4PR11MB6117.namprd11.prod.outlook.com>
Date: Tue, 13 Jun 2023 13:25:11 +0000
From: "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>
To: Paul Menzel <pmenzel@...gen.mpg.de>, "Gardocki, PiotrX"
	<piotrx.gardocki@...el.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>,
	"Kitszel, Przemyslaw" <przemyslaw.kitszel@...el.com>,
	"michal.swiatkowski@...ux.intel.com" <michal.swiatkowski@...ux.intel.com>,
	"kuba@...nel.org" <kuba@...nel.org>, "Nguyen, Anthony L"
	<anthony.l.nguyen@...el.com>, "simon.horman@...igine.com"
	<simon.horman@...igine.com>, "Lobakin, Aleksander"
	<aleksander.lobakin@...el.com>
Subject: RE: [PATCH net-next v2 1/3] net: add check for current MAC address in
 dev_set_mac_address

> Am 13.06.23 um 15:10 schrieb Maciej Fijalkowski:
> > On Tue, Jun 13, 2023 at 02:24:18PM +0200, Piotr Gardocki wrote:
> >> 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.
> >
> > Please use imperative mood here - "add proper check..."
> 
> Just a note, that in “add check …” the verb *add* is already in
> imperative mood. (You can shorten “add noun …” often to just use the
> verb for the noun. In this case:

I just meant to get rid of 'this patch...'

> 
> Check current MAC address in `dev_set_mac_address`
> 
> But it’s not specific enough. Maybe:
> 
> Avoid setting same MAC address
> 
> 
> Kind regards,
> 
> Paul
> 
> 
> >> 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>
> >
> > I'll let Kuba ack it.
> >
> >> ---
> >>   net/core/dev.c | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/net/core/dev.c b/net/core/dev.c
> >> index c2456b3667fe..8f1c49ab17df 100644
> >> --- a/net/core/dev.c
> >> +++ b/net/core/dev.c
> >> @@ -8754,6 +8754,8 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
> >>   		return -EINVAL;
> >>   	if (!netif_device_present(dev))
> >>   		return -ENODEV;
> >> +	if (!memcmp(dev->dev_addr, sa->sa_data, dev->addr_len))
> >> +		return 0;
> >>   	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