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:	Mon, 21 Aug 2006 11:03:51 +0200
From:	Pozsar Balazs <pozsy@...linux.hu>
To:	Jeff Garzik <jgarzik@...ox.com>
Cc:	Valerie Henson <val_henson@...ux.intel.com>,
	Prakash Punnoor <prakash@...noor.de>,
	Jiri Benc <jbenc@...e.cz>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC/PATCH] Fixes for ULi5261 (tulip driver)

On Sat, Aug 19, 2006 at 10:36:17AM -0400, Jeff Garzik wrote:
> Pozsar Balazs wrote:
> >--- a/drivers/net/tulip/uli526x.c	2006-07-15 21:00:43.000000000 +0200
> >+++ a/drivers/net/tulip/uli526x.c	2006-08-18 15:41:00.000000000 +0200
> >@@ -515,7 +515,8 @@
> > 	phy_reg_reset = phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id);
> > 	phy_reg_reset = (phy_reg_reset | 0x8000);
> > 	phy_write(db->ioaddr, db->phy_addr, 0, phy_reg_reset, db->chip_id);
> >-	udelay(500);
> >+	while (phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id) & 0x8000)
> >+		udelay(500);
> 
> You never want an infinite loop in a driver.  If, for example, the 
> hardware is wedged or removed, registers will return all 1's, leading 
> this loop to never end.

Does this seem better?

Signed-off-by: Pozsar Balazs <pozsy@...linux.hu>

Fix uli526x initialization


--- a/drivers/net/tulip/uli526x.c	2006-08-21 10:57:43.000000000 +0200
+++ a/drivers/net/tulip/uli526x.c	2006-08-21 11:01:37.000000000 +0200
@@ -486,6 +486,7 @@
 	u8	phy_tmp;
 	u16	phy_value;
 	u16 phy_reg_reset;
+	int resetwait = 10;
 
 	ULI526X_DBUG(0, "uli526x_init()", 0);
 
@@ -515,7 +516,11 @@
 	phy_reg_reset = phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id);
 	phy_reg_reset = (phy_reg_reset | 0x8000);
 	phy_write(db->ioaddr, db->phy_addr, 0, phy_reg_reset, db->chip_id);
-	udelay(500);
+	while (resetwait-- > 0) {
+		if (!(phy_read(db->ioaddr, db->phy_addr, 0, db->chip_id) & 0x8000))
+			break;
+		udelay(500);
+	}
 
 	/* Process Phyxcer Media Mode */
 	uli526x_set_phyxcer(db);



-- 
pozsy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ