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]
Date:	Thu, 29 Oct 2015 17:09:37 +0800
From:	<shh.xie@...il.com>
To:	<netdev@...r.kernel.org>, <davem@...emloft.net>
CC:	<f.fainelli@...il.com>, Shaohui Xie <Shaohui.Xie@...escale.com>
Subject: [PATCH] net: phy: fix a bug in get_phy_c45_ids

From: Shaohui Xie <Shaohui.Xie@...escale.com>

When probing devices-in-package for a c45 phy, device zero is the last
device to probe, in a rare situation which driver can read a '0' from
the device zero, thus c45_ids->devices_in_package is set to '0', so the
loop condition of probing is matched, see codes below:

for (i = 1;i < num_ids && c45_ids->devices_in_package == 0;i++)

driver will run in a dead loop.

So after probing the device zero, driver should stop the probing loop.

Signed-off-by: Shaohui Xie <Shaohui.Xie@...escale.com>
---
 drivers/net/phy/phy_device.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3833891..065d6d3 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -257,6 +257,10 @@ retry:		reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
 				return 0;
 			}
 		}
+
+		/* stop probe when device zero was probed. */
+		if (!i)
+			break;
 	}
 
 	/* Now probe Device Identifiers for each device present. */
-- 
2.1.0.27.g96db324

--
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