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]
Message-ID: <1317919726-25867-1-git-send-email-madalin.bucur@freescale.com>
Date:	Thu, 6 Oct 2011 19:48:46 +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 2/3] net/phy: avoid reaching an unsupported speed and duplex combination

 - phy_force_reduction() may get the interface into a speed and duplex combination 
 that is not supported by the device;
 - wait PHY_FORCE_TIMEOUT before each speed/duplex reduction in forced mode

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

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 79268f6..31d6519 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -6,7 +6,7 @@
  *
  * Author: Andy Fleming
  *
- * Copyright (c) 2004 Freescale Semiconductor, Inc.
+ * Copyright (c) 2004,2011 Freescale Semiconductor, Inc.
  * Copyright (c) 2006, 2007  Maciej W. Rozycki
  *
  * This program is free software; you can redistribute  it and/or modify it
@@ -479,6 +479,10 @@ static void phy_force_reduction(struct phy_device *phydev)
 
 	idx = phy_find_valid(idx, phydev->supported);
 
+	/* Avoid reaching an invalid speed and duplex combination */
+	if (!(settings[idx].setting & phydev->supported))
+		return;
+
 	phydev->speed = settings[idx].speed;
 	phydev->duplex = settings[idx].duplex;
 
@@ -869,6 +873,8 @@ void phy_state_machine(struct work_struct *work)
 				if (0 == phydev->link_timeout--) {
 					phy_force_reduction(phydev);
 					needs_aneg = 1;
+					phydev->link_timeout =
+						PHY_FORCE_TIMEOUT;
 				}
 			}
 
-- 
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