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:   Sun, 12 Jul 2020 15:16:24 -0700
From:   Florian Fainelli <f.fainelli@...il.com>
To:     netdev@...r.kernel.org
Cc:     Florian Fainelli <f.fainelli@...il.com>, andrew@...n.ch,
        vivien.didelot@...il.com, mkubecek@...e.cz, kuba@...nel.org,
        davem@...emloft.net
Subject: [PATCH net-next 2/3] net: dsa: Implement ndo_equal for CPU port net_device

In order to preserve comparisons of the DSA network device bound to the
switch's CPU port, implement net_device::ndo_equal which will return
true while doing net_device_ops pointer comparisons.

Network device drivers might do these checks to reject notifications
targeting a different net_device instance and those could be
non-functional because of the DSA overloading of net_device_ops. No such
cases are known to exist in tree today.

Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
 net/dsa/master.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/dsa/master.c b/net/dsa/master.c
index 480a61460c23..1c4f0736426e 100644
--- a/net/dsa/master.c
+++ b/net/dsa/master.c
@@ -226,6 +226,14 @@ static int dsa_master_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 	return err;
 }
 
+static bool dsa_master_equal(struct net_device *dev,
+			     const struct net_device_ops *ops)
+{
+	struct dsa_port *cpu_dp = dev->dsa_ptr;
+
+	return cpu_dp->orig_ndo_ops == ops;
+}
+
 static int dsa_master_ethtool_setup(struct net_device *dev)
 {
 	struct dsa_port *cpu_dp = dev->dsa_ptr;
@@ -279,6 +287,7 @@ static int dsa_master_ndo_setup(struct net_device *dev)
 
 	ops->ndo_get_phys_port_name = dsa_master_get_phys_port_name;
 	ops->ndo_do_ioctl = dsa_master_ioctl;
+	ops->ndo_equal = dsa_master_equal;
 
 	dev->netdev_ops  = ops;
 
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ