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: <dbc5f648-4fc0-48f6-be71-cbecd1f54522@huawei.com>
Date: Wed, 11 Sep 2024 21:30:30 +0800
From: Jijie Shao <shaojijie@...wei.com>
To: Kalesh Anakkur Purayil <kalesh-anakkur.purayil@...adcom.com>, Andrew Lunn
	<andrew@...n.ch>
CC: <shaojijie@...wei.com>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <shenjian15@...wei.com>,
	<wangpeiyang1@...wei.com>, <liuyonglong@...wei.com>, <chenhao418@...wei.com>,
	<sudongming1@...wei.com>, <xujunsheng@...wei.com>, <shiyongbang@...wei.com>,
	<libaihan@...wei.com>, <jdamato@...tly.com>, <horms@...nel.org>,
	<jonathan.cameron@...wei.com>, <shameerali.kolothum.thodi@...wei.com>,
	<salil.mehta@...wei.com>, <netdev@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH V9 net-next 11/11] net: add ndo_validate_addr check in
 dev_set_mac_address


on 2024/9/10 16:39, Kalesh Anakkur Purayil wrote:
> On Tue, Sep 10, 2024 at 1:36 PM Jijie Shao <shaojijie@...wei.com> wrote:
>> If driver implements ndo_validate_addr,
>> core should check the mac address before ndo_set_mac_address.
>>
>> Signed-off-by: Jijie Shao <shaojijie@...wei.com>
>> Reviewed-by: Andrew Lunn <andrew@...n.ch>
>> ---
>> ChangeLog:
>> v2 -> v3:
>>    - Use ndo_validate_addr() instead of is_valid_ether_addr()
>>      in dev_set_mac_address(), suggested by Jakub and Andrew.
>>    v2: https://lore.kernel.org/all/20240820140154.137876-1-shaojijie@huawei.com/
>> ---
>>   net/core/dev.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 22c3f14d9287..00e0f473ed44 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -9087,6 +9087,11 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa,
>>                  return -EOPNOTSUPP;
>>          if (sa->sa_family != dev->type)
>>                  return -EINVAL;
>> +       if (ops->ndo_validate_addr) {
>> +               err = ops->ndo_validate_addr(dev);
>> +               if (err)
>> +                       return err;
>> +       }

This patch may not work as expected.

ndo_validate_addr() has only one parameter.
The sa parameter of the MAC address is not transferred to the function.
So ndo_validate_addr() checks the old MAC address, not the new MAC address.

I haven't found a better way to fix it yet.
This patch may be dropped in v10.

Sorry,
	Jijie Shao





Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ