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-next>] [day] [month] [year] [list]
Message-ID: <20241006231938.4382-1-pvmohammedanees2003@gmail.com>
Date: Mon,  7 Oct 2024 04:49:38 +0530
From: Mohammed Anees <pvmohammedanees2003@...il.com>
To: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Andrew Lunn <andrew@...n.ch>,
	Florian Fainelli <f.fainelli@...il.com>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Russell King <linux@...linux.org.uk>,
	Mohammed Anees <pvmohammedanees2003@...il.com>
Subject: [PATCH v2] net: dsa: Fix conditional handling of Wake-on-Lan configuration in dsa_user_set_wol

In the original implementation of dsa_user_set_wol(), the return
value of phylink_ethtool_set_wol() was not checked, which could
lead to errors being ignored. This wouldn't matter if it returned
-EOPNOTSUPP, since that indicates the PHY layer doesn't support
the option, but if any other value is returned, it is problematic
and must be checked. The solution is to check the return value of
phylink_ethtool_set_wol(), and if it returns anything other than
-EOPNOTSUPP, immediately return the error. Only if it returns
-EOPNOTSUPP should the function proceed to check whether WoL can
be set by ds->ops->set_wol().

Fixes: 57719771a244 ("Merge tag 'sound-6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound")
Signed-off-by: Mohammed Anees <pvmohammedanees2003@...il.com>
---
v2:
- Added error checking for phylink_ethtool_set_wol(), ensuring correct
handling compared to v1.
___
 net/dsa/user.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/net/dsa/user.c b/net/dsa/user.c
index 74eda9b30608..bae5ed22db91 100644
--- a/net/dsa/user.c
+++ b/net/dsa/user.c
@@ -1215,14 +1215,17 @@ static int dsa_user_set_wol(struct net_device *dev, struct ethtool_wolinfo *w)
 {
 	struct dsa_port *dp = dsa_user_to_port(dev);
 	struct dsa_switch *ds = dp->ds;
-	int ret = -EOPNOTSUPP;
-
-	phylink_ethtool_set_wol(dp->pl, w);
-
+	int ret;
+
+	ret = phylink_ethtool_get_wol(dp->pl, w);
+
+	if (ret != -EOPNOTSUPP)
+		return ret;
+
 	if (ds->ops->set_wol)
-		ret = ds->ops->set_wol(ds, dp->index, w);
+		return ds->ops->set_wol(ds, dp->index, w);
 
-	return ret;
+	return -EOPNOTSUPP;
 }
 
 static int dsa_user_set_eee(struct net_device *dev, struct ethtool_keee *e)
-- 
2.46.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ