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>] [day] [month] [year] [list]
Date:	Thu, 6 Oct 2011 19:48:57 +0300
From:	Madalin Bucur <madalin.bucur@...escale.com>
To:	<netdev@...r.kernel.org>, <davem@...emloft.net>
CC:	<afleming@...escale.com>,
	Madalin Bucur <madalin.bucur@...escale.com>
Subject: [PATCH 3/3] net/phy: abort genphy_read_status when link changes during speed and duplex reading

If the link changes during speed and duplex reading the values may be out of sync;
abort the update if the link state changes during the read

Signed-off-by: Madalin Bucur <madalin.bucur@...escale.com>
---
 drivers/net/phy/phy_device.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index a1e132c..e88f49a 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -824,6 +824,16 @@ int genphy_read_status(struct phy_device *phydev)
 
 		lpa &= adv;
 
+		err = phy_read(phydev, MII_BMSR);
+
+		if (err < 0)
+			return err;
+
+		/* if the link changed while reading speed and duplex
+		 * abort the speed and duplex update */
+		if (((err & BMSR_LSTATUS) == 0) != (phydev->link == 0))
+			return 0;
+
 		phydev->speed = SPEED_10;
 		phydev->duplex = DUPLEX_HALF;
 		phydev->pause = phydev->asym_pause = 0;
-- 
1.7.0.1


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ